Programmatically Generating Events
Vadim Zeitlin
vadim at wxwidgets.org
Fri Mar 7 13:22:34 PST 2008
On Fri, 7 Mar 2008 08:36:32 -0800 (PST) crjjrc <crjjrc at gmail.com> wrote:
c> > c> First, there's wxControl::Command(event).
c> >
c> > This one doesn't only generate the event but also changes the controls
c> > state to conform to the information in the provided event object. I find it
c> > rather suspicious and never really understood what was it for.
c>
c> This isn't the behavior I observe on GTK. That is,
c>
c> wxCommandEvent fake_event(wxEVT_COMMAND_CHECKBOX_CLICKED,
c> ID_MYCHECK);
c> fake_event.SetInt((int) true);
c> frame->my_check->Command(fake_event);
c>
c> does not check the the checkbox.
This simply means that the implementation of wxCheckBox::Command() is
missing in wxGTK (and the same thing for many other classes). wxMSW does
implement it.
c> The Command method as you describe above is very close to this idea
Yes, indeed.
c> (though I don't see it working as you describe).
It's true that we should either totally deprecate Command() or implement
it. OTOH this would still only take care of wxEvent => wxControl data
transfer and if we implement this then we'd really need, for symmetry, if
nothing else, something like wxWindow::MakeEvent() (taking event type as
parameter?) for wxControl => wxEvent sense. And this starts getting
complicated...
Anyhow, unfortunately I really can't even pretend that I have any
intention of doing this myself so all I can say is that patches
implementing Command() for other ports/classes are welcome (although they
should really go to wxCheckBoxBase and not in various ports wxCheckBox
implementations).
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list