Events sent programmatically

Francesco Montorsi f18m_cpp217828 at yahoo.it
Sat Sep 2 05:31:26 PDT 2006


John Labenski ha scritto:
> On 8/31/06, Francesco Montorsi 
> <f18m_cpp217828 at yahoo.it> wrote:
>> Kevin Ollivier ha scritto:
>> > Hi Francesco,
>> >
>> > On Aug 31, 2006, at 10:29 AM, Francesco Montorsi wrote:
>> >
>> >> Robin Dunn ha scritto:
>> >>> Francesco Montorsi wrote:
>> >>>> I'm not sure if we can find a good definition to decide which
>> >>>> functions should send and which should not send events.
>> >>> I would use the same criteria as for event propagation.  If the event
>> >>> is a command event then it should not be generated when calling an
>> >>> object's method, but if it is not a command event, then it is okay.
>> >> This looks a very good idea to me.
>> >>
>> >> So, in conclusion, can I make a patch which adds the following
>> >> event-free functions:
>> >>
>> >> wxBookCtrl-derived:
>> >>    AddPage => AppendPage
>> >>    DeletePage => RemovePage
>> >>    SetSelection => Select
>> >>
>> >> (no event-free function for AdvanceSelection and InsertPage)
>> >>
>> >> wxTreeCtrl:
>> >>    Delete => Remove
>> >>    DeleteAllItems => RemoveAllItems
>> >>
>> >> (no event-free function for EditLabel)
>> >>
>> >> ?
>> >
>> > If we do add functions for these, please give them more descriptive
>> > names. Something like AddPageSilent, or AddPageNoEvent. This way, just
>> > by reading the code you can know when a function doesn't fire an event.
>> also Vadim already suggested to use e.g. SetSelectionWithoutEvent()
>> instead of Select(). However in that way it will be (mostly) impossible
>> one day to deprecate the functions which send events and have a coherent
>> API...
> 
> +1 Eventually names like AddPageSilent will make no sense.
> 
> Another solution is to add a bool parameter to the end of the
> functions.
this was already proposed IIRC but that is against the deprecate-policy, 
too... :(

Francesco





More information about the wx-dev mailing list