Events sent programmatically

Francesco Montorsi f18m_cpp217828 at yahoo.it
Sat Sep 2 04:28:08 PDT 2006


Vadim Zeitlin ha scritto:
> On Thu, 31 Aug 2006 19:29:03 +0200 Francesco Montorsi <f18m_cpp217828 at yahoo.it> wrote:
> 
> FM> So, in conclusion, can I make a patch which adds the following 
> FM> event-free functions:
> FM> 
> FM> wxBookCtrl-derived:
> FM>     AddPage => AppendPage
> FM>     DeletePage => RemovePage
> 
>  I don't think we need the variants of these functions which don't send
> events because there is no ambiguity here: the user can never directly add
> nor remove notebook pages, so this is _always_ done programmatically.
not sure to understand what you mean: AddPage sends "page changing 
events" (like DeletePage) thus in your OnPageChanged() event handler you 
still cannot know if the event was generated programmatically or not...

thus I think event-free functions would be needed for these functions, 
too... am I missing something?


> FM>     SetSelection => Select
> 
>  The problem here is that we already have both SetSelection() and Select()
> for various multi-item controls (wxListBox, wxChoice, ...) and there the
> difference between them is that the former only works for single-selection
> controls and the latter also works for multi-selection ones. Here the
> difference is something completely unrelated.
I know but since wxbookctrl-based controls cannot have multiple 
selections and don't derive from wxControlWithItems, I still would use 
Select() as name. Otherwise which name could we use (which makes 
SetSelection deprecable in future) ?


> FM> (no event-free function for AdvanceSelection and InsertPage)
> FM> 
> FM> wxTreeCtrl:
> FM>     Delete => Remove
> FM>     DeleteAllItems => RemoveAllItems
> 
>  Again, I don't think we need those: the corresponding events are only
> generated by the program, never by user.
this time I agree - it's obvious that the events were programmatically 
generated. In this case however, if we want to make API coherent we 
should remove the EVT_TREE_DELETE_ITEM event completely, shouldn't we ?


>  OTOH I think the single most annoying method from the event [not] sending
> perspective is wxTextCtrl::SetValue(), it's really the only one for which
> I'd like to have a "silent" or "event-less" version.
right!
I missed it from my list of guilty functions. We could make a 
wxTextCtrl::SetText event-free function (and maybe for simmetry a 
GetText() one). I know many controls use the SetValue()/GetValue() 
function names but... I don't see other clean solutions.

Francesco






More information about the wx-dev mailing list