alexanderp98 has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to update the -readonly section of a textfield if a file exists to allow changes to the text field when the edit button is clicked.
I populate the text field if a file exists but want to give the user the opportunity to make changes, but it doesn't seem to work. Can anyone please tell me what I'm doing wrong? Thanks.
$settings = Win32::GUI::DialogBox->new( -name => 'Settings', -text => 'Configuration Settings', -pos => [ $x, $y ], -width => $dbWidth, -height => $dbHeight, -class => $icon_class, -parent => $Main, ); if (-e $CONFIG_FILE) { $settings->AddButton( -name => 'SettingsEdit', -text => 'Edit', -default => 0, # Give button darker border -width => 60, -height => 20, -left => $settings->ScaleWidth() - 280, -top => $settings->ScaleHeight() - 30, -tabstop => 1, # Allow tab navigation ); } if (-e $CONFIG_FILE) { $readOnlyFlag = 1 } else { $readOnlyFlag = 0 }; # Create Textfield for Edit Text $Settings_HomeDirTF = $settings->AddTextfield( -name => "Settings_homedir", -pos => [100, 30], -size => [200, 20], -multiline => 0, -hscroll => 0, -vscroll => 0, -autohscroll => 1, -autovscroll => 0, -keepselection => 1, -readonly => $readOnlyFlag, -tabstop => 1, # Allow tab navig +ation -prompt => "Home directory:", ); if (-e $CONFIG_FILE) { $stat = ReadConfigFile(); if ($stat == 0) { if (defined($HOMEDIR)) {$Settings_HomeDirTF->Text("$HOMEDIR"); + } if (defined($CONSDIR)) {$Settings_ConsDirTF->Text("$CONSDIR"); + } if (defined($MASTER_SS)) {$Settings_RefFileTF->Text("$MASTER_S +S"); } #$Window->Textfield->Change(-readonly => 1); #$Settings_HomeDirTF->Change(-readonly => 1); } } sub SettingsEdit_Click { print "Edit_Click\n"; $Settings_HomeDirTF->Change( -readonly => 0); $Settings_ConsDirTF->Change( -readonly => 0); $Settings_RefFileTF->Change( -readonly => 0); $Settings_HomeDirTF->Update(); #UpdateWindow $Settings_ConsDirTF->Update(); $Settings_RefFileTF->Update(); return 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Change textfield from readonly and back
by kejohm (Hermit) on Aug 10, 2011 at 01:53 UTC | |
|
Re: Change textfield from readonly and back
by cmac (Monk) on Aug 10, 2011 at 01:58 UTC |