On Tuesday 23 June 2009, Feng Feng wrote:
> Hello all,
>
> What the usage of tryHandle and handle is?
All the widgets call the handlers through tryHandle(), not handle().
The reason is that we don't know what the handler code does; it MAY throw
an exception.
If it does throw an exception, tryHandle() catches the exception and then
returns normally.
Why is this done? Because the logic of many widgets requires that code surrounding
the target->tryHandle() gets executed, in order to leave the widget in a known
state.
If we were to let an exception unroll without executing the surrounding code, we'd
risk leaving the widget in an intermediate state, and this would typically cause
problems later on.
At any rate, the idea is that prior to calling the handler, everything was still
OK, and thus trapping off the exception would be simply picking things up at the
last known-good state anyway.
Putting it in other words: if there is something you'd want to do when an exception
is thrown, you'd better do it prior to returning from the handler, or FOX will do
the exception processing for you.
The exception [pun intended] is we're only doing this with exceptions derived from
FXException. Other types of exceptions are not caught by FOX, and would typically
cause your application to simply bomb.
- Jeroen
------------------------------------------------------------------------------
_______________________________________________
Foxgui-users mailing list
Foxgui-users@...
https://lists.sourceforge.net/lists/listinfo/foxgui-users