← Back to team overview

kicad-developers team mailing list archive

Re: wxWidgets Event Tables or Bind and lambdas

 

Ian,

I would prefer that we not mix event handling styles unless there is a
good reason such as dynamically binding/unbinding for adding temporary
event handling.  For new code, I'm fine with either method with the
caveat that all of the Bind calls be defined in the same function rather
than spread all over the place.  That's one thing I do like about the
event tables.  All of the events are defined in one place.

Cheers,

Wayne

On 7/12/2019 5:11 AM, Ian McInerney wrote:
> This is mainly a code style/implementation question about what should be
> used going forward. I am in the process of going through CVPCB and
> converting it to actions, and also implementing the
> copy/paste/delete/undo/redo features. This necessitates changes to the
> event table (mainly removal of events), but I have also noticed some
> events with smaller handlers (e.g. 1/2 line handlers).
> 
> Other windows seem to use the Bind method with lambda functions for
> these small functions, and I have used them as well for some new
> bindings for the actionization when needed. My main question is, is it
> acceptable to also transition existing events (unaffected by the action
> changes) to use this paradigm? My main thinking is for the 1/2 line
> event handlers such as 
> CVPCB_MAINFRAME::OnSize
> CVPCB_MAINFRAME::OnOK
> CVPCB_MAINFRAME::OnCancel
> CVPCB_MAINFRAME::OnQuit
> (to name a few) to be transitioned to this paradigm.
> 
> Thoughts?
> 
> -Ian
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


References