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

Francesco Montorsi f18m_cpp217828 at yahoo.it
Tue Jul 10 02:14:47 PDT 2007


Frank Bennewitz ha scritto:
> Hi all,
> 
> in my application I have wxSpinCtrl that should increment and decrement integers not by 1 but by 2 so that I would always hav even or uneven numbers. My Problem now is that in the function I added to the event table with EVT_SPINCTRL(ID_SPIN_UNEVEN, MyFrame::OnSpinUneven) the Update of the integer doesn't work. 
> 
> void MyFrame::OnGaussSpin(wxSpinEvent &event) {
> 	int value = event.GetPosition();
> 	event.SetPosition(val+2);
> }
you're only changing the internal event m_position variable in this way.

Rather do:

  void MyFrame::OnGaussSpin(wxSpinEvent &event) {
  	int value = event.GetPosition();
  	m_pMySpinCtrl->SetPosition(val+2);
  }

HTH,
Francesco





More information about the wx-users mailing list