Re: Another FruitBasket with Wx

  • From: "Octavian Rasnita" <orasnita@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 19 Nov 2007 23:55:55 +0200

Hi,

Have you installed it from:
http://www.wxperl.co.uk/wxppm/unicode/package.xml

using ppm?

Try:

ppm rep add WxPerl http://www.wxperl.co.uk/wxppm/unicode/package.xml

Then ppm s Wx

Then install the version from that repository.

This was the version I've installed just a few days ago and it was recommended on the WxPerl mailing list. They told me that Wx::SimpleApp is just a new shorthand for avoiding to define separate packages for the App and the frame, and in fact that module is just a simple 3 lines module, nothing more.

Here below is a sample program that opens a chm file in its window. I put the code and the chm file at:

http://www.tranzactiibursiere.ro/static/ChmHelp.rar

The program can be also used for creating an html help that has those content/index/search tabs, but the result is display using a non-accessible html control.

But you could find a better example in the WxPerl demo program that you can download from search.cpan.org.

use strict;
use Wx;
use Wx::Help;

my $self = Wx::Frame->new(undef, -1, "The test");

$self->{chm_help} = Wx::CHMHelpController->new;

my $chm_file = "example.chm";

$self->{chm_help}->Initialize($chm_file);

$self->{chm_help}->DisplayContents;

$self->Show(1);

Wx::SimpleApp->new->MainLoop;


Octavian

----- Original Message ----- From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, November 19, 2007 11:35 PM
Subject: Re: Another FruitBasket with Wx


I'm interested in that CHM viewer code when you get a chance.

By the way, I'm having trouble running your program even though I think
I have the latest stable WxPerl installed.  I saved the code from your
email post, so perhaps there is some change from the original.  I get
the following error after running
perl fb.pl

Can't locate object method "new" via package "Wx::SimpleApp" (perhaps
you forgot
to load "Wx::SimpleApp"?) at fb.pl line 27.

Jamal
On Mon, 19 Nov 2007, Octavian
Rasnita
wrote:

Date: Mon, 19 Nov 2007 09:20:18 +0200
From: Octavian Rasnita <orasnita@xxxxxxxxx>
Reply-To: programmingblind@xxxxxxxxxxxxx
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Another FruitBasket with Wx

Oh thanks, but don't think that I am as good as you in Wx. I am a real
beginner with this GUI yet.

BTW, I discovered that we can create a CHM viewer using WxPerl with a few
lines of code, and it is as accessible as MS HTML Help viewer.

I haven't discovered yet how to find the object of a control or menu if I
know its ID though.

Octavian

----- Original Message -----
From: "Jamal Mazrui" <empower@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, November 19, 2007 6:09 AM
Subject: Re: Another FruitBasket with Wx


> 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
>

__________
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


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: