PythonWin and Dialogs in DLLs

mhammond at my-deja.com mhammond at my-deja.com
Wed Jan 19 13:07:13 EST 2000


In article <3884a59a$0$22486 at senator-bedfellow.mit.edu>,
  "Robert" <soundhack at hotmail.com> wrote:

> now one more question. I have gotten the subclassed dialog to show
> up, but am having problems with assigning message handlers to buttons.
> Following one of the demos, I did something like the following
>
> (in the dialog's InitDialog method)
>     self.button=self.GetDlgItem(IDC_CMD_BUTTON)
>     self.button.HookNotify(self.OnButton,win32con.BN_CLICKED)
>
> When i click on the button, the OnButton handler isnt getting called.
> I tried self.button.HookCommand() too, with no results. The one thing
> that sorta worked was
> self.button.HookMessage(self.OnButton,win32con.WM_LBUTTONDOWN), which
is not
> exactly what
> I wanted (sometimes the button click animation isnt shown)

Notification messages are handled by the parent, not the object - ie,
you simply do "self.HookMessage" - hook it from the dialog, not the
parent.

If you grep the Pythonwin sources you should find a number of
HookNotify examples - it is used all over the place...

Mark.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list