From: Ed H. <ed...@do...> - 2006-08-05 02:42:03
|
We've been talking about trying to put together a "test scripting language" for our big wxPerl application. We'd like to be able to write a file full of commands stated in some very simplistic code like -- text-enter name "Smith" button-click update check name equals "Smith" that sort of thing -- and have the program trigger the appropriate series of events, and make sure the right things happen. I tried to put together a minimalist, "proof of concept" demo. I put together in wxglade a tiny application with a couple buttons and other controls on it. I made an event handler for the first button which called the function $frame->fake_event(). fake_event looks like this: sub fake_event { my $self=shift; my $entry = "Testing"; my $event=Wx::CommandEvent->new(wxEVT_COMMAND_BUTTON_CLICKED); $event->SetEventObject($self->{button2}); } I'd only gotten that far -- I hadn't figured out any more than generating the event and setting its EventObject -- and I ran that and got this -- C:\src>EventTester.pl (I clicked on the button to trigger fake_event and...) Can't locate object method "SetEventObject" via package "Wx::CommandEvent" at C: \src\EventTester.pl line 169. C:\src> Uh oh. SetEventObject is a method of Wx::Event, and Wx::CommandEvent is a subclass of Wx::Event, so that should have been found. I've got two basic questions -- 1. For people who know wxWidgets better than I do -- does this seem like a profitable direction to go? Is this a crazy, doomed idea or is it supposed to be possible to do this sort of thing? 2. Was that error ("Can't locate object method") just missing its perl wrapper, or was something deeper going wrong? Thanks, all -- Ed |