Hi,

herbert gave me an excellent starting point - thanks to him.
his sample worked fine for me and no here is my first tryout - but unfortunatley it crashes with this message.

"Can't call method "Connect" on an undefined value at /Library/Perl/ 5.8.6/darwin-thread-multi-2level/Wx/Event.pm line 40"

Attached are my files. I have made one frame with 1 Text, 1 Choice and 1 Button. I attached a screenshot from the Designer i used.
May somebody, with more experience can have a look at.

Also I would like to know if I have to have all EVT allready declared, that the Frame will show up - at all? Or can I have more elements in the XRC source as I use inside the program?

I mean: Can I launch the app step by step while I integrate the functionality?

Thaks and have a nice weekend.
Alexander


#!/usr/bin/perl -w

use strict;
use warnings;
use Carp;

package LaserCalc;

our $VERSION = '0.1a';
use Wx qw/ :everything /;
use Wx::Event qw/ :everything /;
use Wx::XRC;
use base qw(Wx::App);

sub OnInit {
	my $app   = shift;
	my $xr = Wx::XmlResource->new();
	$xr->InitAllHandlers();
	$xr->Load('lasercalc_wdr.xrc');
	my $frame = $xr->LoadFrame(undef, 'MyDialogFunc');
	
	my $XID = \&Wx::XmlResource::GetXRCID;
	
	EVT_CHOICE($frame, &$XID('ID_CHOICE'), sub {
	print"not defined yet\n";
	} );

	EVT_BUTTON($frame, &$XID('ID_BUTTON'), sub {
	print"not defined yet\n";
	} );
	

	$frame->Show(1);                        # Fenster zeichnen
	$app->SetTopWindow($frame);             # Fenster als oberstes bestimmen
	1;
} # /OnInit


package main;
LaserCalc->new->MainLoop;


Attachment: laserCalc_wdr.xrc
Description: Binary data



Attachment: screenshot.pdf
Description: Adobe PDF document

Reply via email to