[wx 2.8.4, GTK+ 2, g++] Problem updating value of wxSpinCtrl in wxSpinEvent

Francesco Montorsi f18m_cpp217828 at yahoo.it
Tue Jul 10 03:54:26 PDT 2007


Francesco Montorsi ha scritto:
> Frank Bennewitz ha scritto:
>> Hi Francesco,
>>
>> I tried this:
>>
>> void MyFrame::OnGaussSpin(wxSpinEvent &event) {
>>     
>>     //Hier muss die Behandlung der Werte rein: es dürfen nur ungerade 
>> Integer sein.
>>     
>>     wxSpinCtrl *m_pMySpinCtrl= 
>> (wxSpinCtrl*)FindWindowById(PANEL_GAUSS_SPIN);
>>     int val=event.GetPosition();
>>       m_pMySpinCtrl->SetValue(val-2);
>> }
>>
>> and it still doesn't work. The Problem is (I guess) that after 
>> m_pMySpinCtrl->SetValue(val-2) is called, another EVT_SPINCTRL is fired
> this is a "bug". Either in the documentation or in wxSpinCtrl.
> 
> It should be fixed like we did for other controls adding an event-free 
> function to wxSpinCtrl... (see the paragraph "user generated events vs 
> programmatically generated events").

A workaround for now is to use the wxEventBlocker class (but I'm not 
sure if it's only in wxSVN or also in wx2.8)...

HTH,
Francesco






More information about the wx-users mailing list