[wxPython-users] FlatNotebook don't generate events with SetSelection

Oswaldo Hernández listas at soft-com.es
Tue Jul 24 08:58:08 PDT 2007


Robin Dunn escribió:
> Oswaldo Hernández wrote:
>> Hello,
>>
>> When change the active page on FlatNotebook with 
>> flatnotebook.SetSelection(pagenum) the page is raised but the events 
>> EVT_FLATNOTEBOOK_PAGE_CHANGING and EVT_FLATNOTEBOOK_PAGE_CHANGED are 
>> not raised.
>>
> 
> This guideline isn't followed everywhere in wx because of historical 
> reasons, but the general rule is that command events should not happen 
> when the thing that generates this event is done programatically instead 
> of because of some user action, and there has been some work to remove 
> or change some cases where calling methods currently causes the event to 
> be emitted.  I expect that the original FlatNotebook code was following 
> this guideline rather than what the native notebook does.
> 

FlatNotebook doc:
<http://wxpython.wxcommunity.com/docs/api/wx.lib.flatnotebook.FlatNotebook-class.html#SetSelection>
say:

SetSelection(self, page)
Sets the selection for the given page. The call to this function *generates* the page changing events

I don't now if its a bug in doc or in the code.

About the rule that events should not happen when the thing that generate it is done 
programatically, i don't understand it.
Do you mean that if i put some code on a TreeCtrl EVT_TREE_ITEM_EXPANDED (example) these code must 
only run when the user click, and may not run whe i do TreeCtrl.Expand(item)?
For now it's run. May not run in future versions?



-- 
*****************************************
Oswaldo Hernández
oswaldo (@) soft-com (.) es
*****************************************




More information about the wxpython-users mailing list