Why "-tabsotp=>1" can't directly work in the standard WINDOW?
Why has to be able to use in DialogUI?
After also has adds on -dialogui=>1, Textfield controls in not to be able to
input <TAB>,
I now have the solution:
$Win->AddTextfield(
-text => "",
-name => "Result",
-left => 7,
-top => 78,
-width => 622,
-height => 395,
-autovscroll => 1,
-multiline => 1,
-hscroll => 1,
-vscroll => 1,
-autohscroll => 1,
-popstyle => WS_BORDER,
-addstyle => ES_WANTRETURN,
);
sub Result_KeyDown
{
my $key=Win32::GUI::GetKeyboardState;
$Win->{Result}->ReplaceSel("\t") if $key->[0x09];
}
Also has a better method?
rob
Robert May 写道:
[EMAIL PROTECTED] wrote:
hi all
If does not add on "$Win->{'-dialogui'}=1",then "-tapstop=>1" cannot use,
Please don't access the object's hash directly like this, it might stop
working at some stage. Please use the constructor's -dialogui option,
the Change() method, or the DialogUI() method. The following all
achieve the same thing:
my $win = Win32::GUI::Window->new(
...
-dialogui => 1,
...
);
$win->Change(-dialogui => 1);
$win->DialogUI(1);
but if adds on "$Win->{'-dialogui'}=1",
then "$Win->AddTextfield(-multiline=>1, ...)" has been invalid,
in Textfield cannot knock the Enter....
Setting DialogUI(1) on a top level window makes it behave as a
'standard' windows dialog, where the <ENTER> key is mapped to the
default behaviour (usually the 'OK' button). If you want a multi-line
textfield to be able to have <Enter> make a new-line, then you need to
add the ES_WANTRETURN style to the textfield. There is no
Win32::GUI::Textfield support of this directly (although there probably
should be). The following will do what you want:
use Win32::GUI qw(ES_WANTRETURN);
my $win = Win32::GUI::Window->new(
...
);
$win->AddTextfield(
...
-addstyle => ES_WANTRETURN,
);
Regards,
Rob.