« Return to Thread: What the usage of tryHandle and handle

Re: What the usage of tryHandle and handle

by Jeroen van der Zijp :: Rate this Message:

Reply to Author | View in Thread

On Tuesday 23 June 2009, Feng Feng wrote:

> Hello all,
>
> What the usage of tryHandle and handle is?
>
> And, when I should use it?
>
> // Somebody wants our the selection
> long FXWindow::onSelectionRequest(FXObject*,FXSelector,void* ptr){
>   return target && target->tryHandle(this,FXSEL(SEL_SELECTION_REQUEST,message),ptr);
>   }
>
>   // Update Alpha text fields
> long FXColorSelector::onUpdAlphaText(FXObject* sender,FXSelector,void*){
>   FXString value;
>   if(isOpaqueOnly()){
>     sender->handle(this,FXSEL(SEL_COMMAND,ID_HIDE),NULL);
>     }
>   else{
>     ...
>     }
>   return 1;
>   }

To elaborate slightly on the exception issue:

When FOX widgets call handlers in YOUR code, we do so with tryHandle().

When YOUR code invokes a update handler in FOX, you can use handle() since
FOX won't throw an exception anyway.  It is totally OK to call tryHandle()
if it pleases you, but it is not necessary...


                - Jeroen

------------------------------------------------------------------------------
_______________________________________________
Foxgui-users mailing list
Foxgui-users@...
https://lists.sourceforge.net/lists/listinfo/foxgui-users

 « Return to Thread: What the usage of tryHandle and handle