I assume I should generate a wxCommandEvent and then send it to the main window:
Code: Select all
wxCommandEvent *myEvent=new wxCommandEvent();
...
this->Command(myEvent);
Code: Select all
wxCommandEvent *myEvent=new wxCommandEvent();
...
this->Command(myEvent);
Code: Select all
wxCommandEvent evt = wxCommandEvent(wxEVT_COMMAND_SLIDER_UPDATED,window_id);
Code: Select all
wxCommandEvent evt=wxCommandEvent(wxEVT_COMMAND_SLIDER_UPDATED, ID_MYSLIDER);
evt.SetInt(50);
MySlider->Command(evt);
I mean simulating a mouse click on the slider so that not only the slider value will be changed but also the connected event handlers will be run.Not sure what you mean simulating user interaction
Code: Select all
wxScrollEvent evt=wxScrollEvent(wxEVT_SCROLL_PAGEDOWN, ID_MYSLIDER);
evt.SetPosition(50);
evt.SetEventObject( MySlider );
MySlider->Command(evt);
Yes, it does. The range is 0-100, so 50 is valid.I presume your slider works properly if you operate it manually, and that you're trying to set a value that is it's allowable range.
wxWidgets 2.8, Ubuntu Feisty, g++ (GCC) 4.1.2What version, OS, etc. are you using?
I'm not free to share large chunks of code (the project is not open-source), but the reason I was asking is this:Failing that, is there another code snippet you could share?
Code: Select all
void wxSlider::Command (wxCommandEvent & event)
{
SetValue (event.GetInt());
ProcessCommand (event);
}