Posted on 2009-07-12 23:15:06-07 by andi
Newbie not familiar with oop seeks help for the widget
Hello, until now I completed some perl scripts. Now I just wanted to start one of them form a prima-gui. The script needs a string variable as argument. With "VB" it is easy to set up a simple form wich contains an input line to type in the argument and an OK-Button to start the script. But how do I get the string, the value of the changed input line? Unfortunately this ist not covered by the tutorial. Since I am not familiar with object oriented programming, I didn't get it. Can I access the value direct like the content of a hash or is there a special method required? This is the generated code from "VB" (Question: How do I get the entered/changed value of "InputLine"?):
package Form1Window; use Prima; use Prima::Classes; use vars qw(@ISA); @ISA = qw(Prima::MainWindow); use Prima::Buttons; use Prima::InputLine; sub profile_default { my $def = $_[ 0]-> SUPER::profile_default; my %prf = ( sizeDontCare => 0, origin => [ 810, 500], name => 'Form1', originDontCare => 0, size => [ 115, 100], width => 115, height => 100, left => 810, bottom => 500, designScale => [ 5, 13], ); @$def{keys %prf} = values %prf; return $def; } sub init { my $self = shift; my %instances = map {$_ => {}} qw(); my %profile = $self-> SUPER::init(@_); my %names = ( q(Form1) => $self); $self-> lock; $names{InputLine1} = $names{Form1}-> insert( qq(Prima::InputLine) => name => 'InputLine1', origin => [ 8, 81], size => [ 96, 17], ); $names{Button1} = $names{Form1}-> insert( qq(Prima::Button) => origin => [ 4, 14], name => 'Button1', size => [ 96, 36], ); $self-> unlock; return %profile; package Form1Auto; use Prima::Application; Form1Window-> create; run Prima;
Thanks for your help, Andi
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.