For single line input action, on a multiline textfield:
sub Input_Change {
$_=$Window->Input->GetLineCount();
if ($_>1) {
$_=$Window->Input->GetLine($_-2);
##Do on enter
}
}
Jerome McKean
Dream ƒrequency; Imagination Realised
http://dreamfrequency.com
From: larry moore
<[EMAIL PROTECTED]>
RE: Textfield
2002-05-14 06:52 |
Upon a little closer look at the documentation for -multiline, it says the
the return is \r\n, will this make a difference to my chomp? Should I be
removing \r\n and searching for both chars?
Thanks,
Larry
-----Original Message-----
From: Sean Healy [mailto:[EMAIL PROTECTED]...]
Sent: Tuesday, May 14, 2002 9:44 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [perl-win32-gui-users] Textfield
>Is there a way to make the return key register for a Textfield. I am using
>a sub Textfield_1_Change and would like to use the -text for this object to
>be used in a search string when the user has hit the return key. As a
>first
>step, I have been echoing each key press to the dos window, but the return
>key seems to have no effect.
Here"s a workaround:
Make the Textfield -multiline => 1.
Use the _Change event:
Grab the text whenever the user changes it
Test the text against =~s/\n//g;
Return if this test fails
Restore the text
Do your search
I used to simply check that the text string ended with a \n and then chomp
it and restore the text. But if a user wants to redo the same search, he
might just click anywhere in the textfield and hit enter, so your \n could
be anywhere in the text string.
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
|
|