Well done, Octavian -- congratulations! Jamal On Sat, 17 Nov 2007, Octavian Rasnita wrote: > Date: Sat, 17 Nov 2007 21:56:28 +0200 > From: Octavian Rasnita <orasnita@xxxxxxxxx> > Reply-To: programmingblind@xxxxxxxxxxxxx > To: programmingblind@xxxxxxxxxxxxx > Subject: Another FruitBasket with Wx > > Hi, > > I've made another FruitBasket made with Wx in perl. I've seen that the > syntax of WxPerl is not so nice as the syntax of Win32::GUI, but I thought > that the source code should be smaller, because it doesn't use that > hash-style of providing parameters to functions. > > Finally I've made a Fruit Basket with WxPerl that has only around 750 > characters, and it is still pretty clear. The version below has 950 > characters because it has some more spaces. > > It might be helpful for those who want to learn WxPerl, especially that > there is so little documentation for WxPerl. > (I've created an executable program and I put it and the source code, and a > version with some explanations at: > http://www.tranzactiibursiere.ro/static/FruitBasket_Wx.rar > > Here it is: > > use strict; > use Wx qw(wxALIGN_RIGHT); > use Wx::Event qw(EVT_BUTTON); > > my $frame = Wx::Frame->new(undef, -1, "The app", [-1,-1], [200,150]); > > my $panel = Wx::Panel->new($frame, -1); > > Wx::StaticText->new($panel, -1, "&Fruit:", [20,20], [30,20], wxALIGN_RIGHT); > > my $fruit = Wx::TextCtrl->new($panel, -1, "", [50,20], [100,20]); > > my $add = Wx::Button->new($panel, -1, "&Add", [150,20], [50,20]); > > $add->SetDefault; > > Wx::StaticText->new($panel, -1, "F&ruits:", [20,60], [30,20], > wxALIGN_RIGHT); > > my $list = Wx::ListBox->new($panel, -1, [50,60], [100,100]); > > my $del = Wx::Button->new($panel, -1, "&Delete", [150,60], [50,20]); > > EVT_BUTTON($frame, $add, \&add); > EVT_BUTTON($frame, $del, \&del); > > $frame->Show(1); > Wx::SimpleApp->new->MainLoop; > > sub add { > my $current_fruit = $fruit->GetValue; > > if (defined $current_fruit) { > $list->Append($current_fruit); > $fruit->Clear; > } > } > > sub del { > my $index = $list->GetSelection; > $list->Delete($index) if $index >= 0; > } > > > > Octavian > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind