[perl-win32-gui-users] Executing a subroutine when selecting a radio button

2010-02-24 Thread Love, Bradley
Hi,

 

I am trying to set up an action using radio buttons that when it is
selected it changes the readonly state of the text field (see below
code).  This code runs but the subroutine does not work when the radio
button is selected.  I expect that the -click option is not doing what I
want it to do.  Does anyone have any suggestions on how to get the
functionality that I am looking for?

 

Cheers!

 

 

 

#!perl -w

use strict;

#use warnings;

use Win32::GUI();

 

my $w = 250;

my $h = 100;

my $main = Win32::GUI::Window-new(

-name = 'Main',

-text = 'Example Window',

-width = $w,

-height = $h,

-resizable = 0

);

 

$main-AddRadioButton (

-name= 'radio_1',

-pos = [10, 10],

-size= [12,12],

-checked = '1',

-click = sub{$main-user_text-Change(-readonly = 1);},

);

 

$main-AddLabel(

-text = Disable Textfield,

-pos = [25,10],

);

 

$main-AddRadioButton (

-name= 'radio_2',

-pos = [10, 30],

-size= [12,12],

-click = sub{$main-user_text-Change(-readonly = 0);},

);

 

$main-AddLabel(

-text = Enable Textfield,

-pos = [25,30],

);

 

$main-AddTextfield(

-name = 'user_text',

-pos = [110,28],

-size = [60,20],

-align = 'left',

-readonly = 1,

);

 

$main-Show();

Win32::GUI::Dialog();

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Re: [perl-win32-gui-users] Executing a subroutine when selecting a radio button

2010-02-24 Thread Kevin Marshall

Bradley,

 

It should be -onclick instead of -click. Also, instead of using the Change() 
method, use ReadOnly(1) to enable readonly and ReadOnly(0) to disable.

 

Hope this helps,

 

Kevin.
 


Date: Wed, 24 Feb 2010 13:28:09 -0500
From: bradley.l...@bioreliance.com
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Executing a subroutine when selecting a radio 
button







Hi,
 
I am trying to set up an action using radio buttons that when it is selected it 
changes the readonly state of the text field (see below code).  This code runs 
but the subroutine does not work when the radio button is selected.  I expect 
that the –click option is not doing what I want it to do.  Does anyone have any 
suggestions on how to get the functionality that I am looking for?
 
Cheers!
 
 
 
#!perl -w
use strict;
#use warnings;
use Win32::GUI();
 
my $w = 250;
my $h = 100;
my $main = Win32::GUI::Window-new(
-name = 'Main',
-text = 'Example Window',
-width = $w,
-height = $h,
-resizable = 0
);
 
$main-AddRadioButton (
-name= 'radio_1',
-pos = [10, 10],
-size= [12,12],
-checked = '1',
-click = sub{$main-user_text-Change(-readonly = 1);},
);
 
$main-AddLabel(
-text = Disable Textfield,
-pos = [25,10],
);
 
$main-AddRadioButton (
-name= 'radio_2',
-pos = [10, 30],
-size= [12,12],
-click = sub{$main-user_text-Change(-readonly = 0);},
);
 
$main-AddLabel(
-text = Enable Textfield,
-pos = [25,30],
);
 
$main-AddTextfield(
-name = 'user_text',
-pos = [110,28],
-size = [60,20],
-align = 'left',
-readonly = 1,
);
 
$main-Show();
Win32::GUI::Dialog(); 
_
Looking for a place to rent, share or buy? Find your next place with ninemsn 
Property
http://clk.atdmt.com/NMN/go/157631292/direct/01/--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/