The confusing thing is your terminology. Your control is an textfield, and textfields don't do anything in response to single clicks, so setting an empty onClick handler isn't going to change it's behaviour.
If you said "I want to stop the user from being able to edit the text displayed in the Textfield", then it would be fairly obvious that you don't want to 'disable the control', you want to 'set the TextField readonly', which is a fairly common thing to want to do to edit fields and there is therefore an option for doing exactly that (called -readonly :). Try this
use strict;
use Win32::GUI;
use Win32::API;
our $mainform = Win32::GUI::Window->new(
-name=>'main',
-text=>'main',
) or die "window creation failed: $!\n";
our $test = $mainform->AddTextfield(
-name=>'test',
-text=>'test',
-left=>200,-top=>200,
-width=>100,-height=>20,
-readonly => 1,
) or die "control creation failed: $!\n";
$mainform->Show();
Win32::GUI::Dialog;
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|