From: Bradley K. E. <bk...@bk...> - 2006-10-13 05:35:26
Attachments:
minimal.pl
|
A coworker of mine asked about this previously, http://sourceforge.net/mailarchive/forum.php?thread_id=30118212&forum_id=3459, and I am working on implementing our testing strategy. Based on input from Mattia in the above thread, and thanks to wxEvent::SetEventObject now being wrapped, I'm attempting to generate events with the following code: my $event = Wx::CommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED); $event->SetEventObject( $button ); $window->GetEventHandler()->ProcessEvent($event); See the attached minimal example and you'll understand what I am trying to accomplish. There are no error messages, but it is not working. Am I missing something? Doing something wrong? I'm not sure where to go from here and any help would be appreciated. Thanks, Brad |
From: Lucian D. <lu...@eu...> - 2006-10-13 12:00:18
|
You must use the Wx::PlCommandEvent class. > > my $event = Wx::CommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED); my $event = Wx::PlCommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED, $self->{button_a}->GetId); > $event->SetEventObject( $button ); > $window->GetEventHandler()->ProcessEvent($event); > Best regards, Lucian Dragus |
From: Lucian D. <lu...@eu...> - 2006-10-13 12:19:21
|
In fact, I was wrong: is working with Wx::PlCommandEvent _or_ Wx::CommandEvent, but you must set the Id. > You must use the Wx::PlCommandEvent class. > > > my $event = Wx::CommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED); > > my $event = Wx::PlCommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED, > $self->{button_a}->GetId); > > > $event->SetEventObject( $button ); > > $window->GetEventHandler()->ProcessEvent($event); > > Best regards, > Lucian Dragus > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > wxperl-users mailing list > wxp...@li... > https://lists.sourceforge.net/lists/listinfo/wxperl-users |
From: Bradley K. E. <bk...@bk...> - 2006-10-14 03:16:40
|
Thanks Lucian and Daniel. I've got the event firing now both in the minimal example I sent to the list as well as the "real" code I was working on. It looks like calling SetEventObject is not necessary, but passing the id of the object to the Wx::CommandEvent constructor is necessary. Thanks again, Brad Lucian Dragus wrote: > In fact, I was wrong: is working with Wx::PlCommandEvent _or_ > Wx::CommandEvent, but you must set the Id. > >> You must use the Wx::PlCommandEvent class. >> >>> my $event = Wx::CommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED); >> my $event = Wx::PlCommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED, >> $self->{button_a}->GetId); >> >>> $event->SetEventObject( $button ); >>> $window->GetEventHandler()->ProcessEvent($event); >> Best regards, >> Lucian Dragus >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job >> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache >> Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> wxperl-users mailing list >> wxp...@li... >> https://lists.sourceforge.net/lists/listinfo/wxperl-users > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > wxperl-users mailing list > wxp...@li... > https://lists.sourceforge.net/lists/listinfo/wxperl-users > |
From: Schmoger, D. <dan...@sa...> - 2006-10-13 12:03:12
|
Hi Brad, please try this code to fake an event: my $event =3D Wx::CommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED,$button->GetId);=20 $window->AddPendingEvent($event); It works in my app without problems. In your example i'd suggest: sub _evt_button_b { my $self =3D shift; my $evt =3D shift $evt->SetId ($self->{button_a}->GetId); $self->AddPendingEvent($evt); } Regards, Daniel =20 -----Original Message----- From: wxp...@li... [mailto:wxp...@li...] On Behalf Of Bradley K. Embree Sent: Freitag, 13. Oktober 2006 07:35 To: wxperl >> "Wxp...@Li..." Subject: [wxperl-users] Faking Events A coworker of mine asked about this previously,=20 http://sourceforge.net/mailarchive/forum.php?thread_id=3D30118212&forum_i= d =3D3459,=20 and I am working on implementing our testing strategy. Based on input from Mattia in the above thread, and thanks to=20 wxEvent::SetEventObject now being wrapped, I'm attempting to generate=20 events with the following code: my $event =3D Wx::CommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED); $event->SetEventObject( $button ); $window->GetEventHandler()->ProcessEvent($event); See the attached minimal example and you'll understand what I am trying=20 to accomplish. There are no error messages, but it is not working. Am I missing=20 something? Doing something wrong? I'm not sure where to go from here and any help would be appreciated. Thanks, Brad |