can I find the "next" event handler ?

hello,

This is kind of weird problem,
and I'm not sure I can describe it very well,
so I'll hope you'll understand what my problem is.

I've dynamically build forms,
and now I want that handling of the menu-event is done in the following way:

1- if a menu item is enabled / disabled is handled by the focused control (works)
2- the menu event is first handled by the frame / container, which does some preprocessing
3- then the focused control should perform it's work,
but not by calling event.Skip() in the frame's event handler,
but by an explicit call from the frame's event handler.
The reason for this is that the frame's event handler should perform some post-processing,
which can only be done after the focussed control has finished it's action.
Now the focussed control has also bound a event handler to this menu item
(that's because it's a general purpose control, and also by that the enabling of the menu-item is controlled ).
Can the frame determine if the focussed control has an event handler,
so it can call it explicitly (and doing the post-processing afterwards) ?

thanks,
Stef Mientki

Stef Mientki wrote:

hello,

This is kind of weird problem,
and I'm not sure I can describe it very well,
so I'll hope you'll understand what my problem is.

I've dynamically build forms,
and now I want that handling of the menu-event is done in the following way:

1- if a menu item is enabled / disabled is handled by the focused control (works)
2- the menu event is first handled by the frame / container, which does some preprocessing
3- then the focused control should perform it's work,
but not by calling event.Skip() in the frame's event handler,
but by an explicit call from the frame's event handler.
The reason for this is that the frame's event handler should perform some post-processing,
which can only be done after the focussed control has finished it's action.
Now the focussed control has also bound a event handler to this menu item
(that's because it's a general purpose control, and also by that the enabling of the menu-item is controlled ).
Can the frame determine if the focussed control has an event handler,
so it can call it explicitly (and doing the post-processing afterwards) ?

thanks,
Stef Mientki

I'm not sure, but you should be able to do it by keeping a dict of widget ids and their primary handlers. Then in the handler you're talking about, you would use something like event.GetId() to nab that id and a loop to check if it's in your dict's keys.

Theoretically, I think that would work. Maybe someone else on the list has a more elegant approach though...

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

Mike Driscoll wrote:

Stef Mientki wrote:

hello,

This is kind of weird problem,
and I'm not sure I can describe it very well,
so I'll hope you'll understand what my problem is.

I've dynamically build forms,
and now I want that handling of the menu-event is done in the following way:

1- if a menu item is enabled / disabled is handled by the focused control (works)
2- the menu event is first handled by the frame / container, which does some preprocessing
3- then the focused control should perform it's work,
but not by calling event.Skip() in the frame's event handler,
but by an explicit call from the frame's event handler.
The reason for this is that the frame's event handler should perform some post-processing,
which can only be done after the focussed control has finished it's action.
Now the focussed control has also bound a event handler to this menu item
(that's because it's a general purpose control, and also by that the enabling of the menu-item is controlled ).
Can the frame determine if the focussed control has an event handler,
so it can call it explicitly (and doing the post-processing afterwards) ?

thanks,
Stef Mientki

I'm not sure, but you should be able to do it by keeping a dict of widget ids and their primary handlers. Then in the handler you're talking about, you would use something like event.GetId() to nab that id and a loop to check if it's in your dict's keys.

thanks Mike,
I don't think doing the administration, the high language should do, isn't very elegant.
I now use another not very elegant method: the focussed control must use a known name:

  # **************************************************
  def OnMenu_Open ( self, event ) :
    # pass the Open File to the focussed control
    FC = self.FindFocus ()
    if hasattr ( FC, 'OnMenu_Open' ) :
      FC.OnMenu_Open ()

cheers,
Stef

···

Theoretically, I think that would work. Maybe someone else on the list has a more elegant approach though...

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users