1. Possible problem with setNotifyHandler

Derek,

I may be either using this incorrectly or have found a possible problem 
regarding notification handlers.  I have a main program that uses:

void = setNotifyHandler( NM_RCLICK, routine_id("DoNM_RCLICK"))

to handle when the user right clicks in a tree view.  I have now 
developed a dialog to search for objects that also contains the same 
call (also contains the same routine, but not defined as a global).

When the dialog is called all right clicks are working fine.  Upon 
returning from the dialog to the main window the right click 
notification no longer happens in the main program but works fine in 
subsequent calls to the dialog.  In the main program after the call to 
the dialog procedure I added:

void = setNotifyHandler( NM_RCLICK, routine_id("DoNM_RCLICK"))

and the right clicks began working again in the main program.

Am I doing something wrong?

Thanks,

Jonas

new topic     » topic index » view message » categorize

2. Re: Possible problem with setNotifyHandler

----- Original Message ----- 
From: "Jonas Temple" <jtemple at yhti.net>
To: <EUforum at topica.com>
Subject: Possible problem with setNotifyHandler


> 
> 
> Derek,
> 
> I may be either using this incorrectly or have found a possible problem 
> regarding notification handlers.  I have a main program that uses:
> 
> void = setNotifyHandler( NM_RCLICK, routine_id("DoNM_RCLICK"))
> 
> to handle when the user right clicks in a tree view.  I have now 
> developed a dialog to search for objects that also contains the same 
> call (also contains the same routine, but not defined as a global).
> 
> When the dialog is called all right clicks are working fine.  Upon 
> returning from the dialog to the main window the right click 
> notification no longer happens in the main program but works fine in 
> subsequent calls to the dialog.  In the main program after the call to 
> the dialog procedure I added:
> 
> void = setNotifyHandler( NM_RCLICK, routine_id("DoNM_RCLICK"))
> 
> and the right clicks began working again in the main program.
> 
> Am I doing something wrong?
> 

Let me see if I understand this...

You have two source code files, and for the sake of this discussion let's call
them main.exw and dialog.ew. And each of these files has a routine called
"DoNM_RCLICK" defined in them. And each file invokes the setNotifyHandler()
function.

Well, setNotifyHandler() will cause win32lib to call the last handler code you
passed to it. In other words, just because your dialog routine returned control
to the main program, it doesn't mean that win32lib reverted to the DoNM_RCLICK
defined in the main program. It would still be calling the one defined in the
dialog routine when a right mouse click occured in the main program. That is why
you would need to reset the handler when the dialog returned.

What you might like to consider doing, is in the dialog program ...

   prevId = setNotifyHandler( NM_RCLICK, routine_id("DoNM_RCLICK"))

And then, just before returning to the main program, do this ...

   void = setNotifyHandler( NM_RCLICK, prevId)

Then you won't need to reset it in the main program.
-- 
Derek

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu