Hi,

Here is a test script that shows that the cursor cannot be moved out from a
Textfield using <tab> key.
I have also noticed that I cannot put a "\n" (or better said "\r\n"
character in the text field when pressing enter, and I need to press
control+Enter to be able to insert an end of line.

I guess I am doing something wrong.

I have tried to use your function for moving the focus with the Textfield,
but it doesn't work.

Thank you for your help.


use strict;
use Win32::GUI;

my $W = new Win32::GUI::Window(
-name => 'Window',
-text => 'Testing',
-top => 100,
-left => 100,
-width => 500,
-height => 500,
);

$W->{-dialogui} = 1;

my $Text = $W->AddTextfield(
-name => 'TextField',
-text => 'example',
-top => 10,
-left => 10,
-width => 480,
-height => 300,
-multiline => 1,
-tabstop => 1,
);

my $Button = $W->AddButton(
-name => 'But',
-text => 'ok',
-left => 200,
-top => 400,
-width => 100,
-height => 25,
-tabstop => 1,
);

$W->Show;
$W->Dialog;


sub Textfield_KeyPress {
my($key) = @_;

if($key == 9) {
$W->But->SetFocus();
}
}

Teddy


----- Original Message ----- 
From: "Peter Eisengrein" <[EMAIL PROTECTED]>
To: "'Octavian Rasnita'" <[EMAIL PROTECTED]>;
<Perl-Win32-Users@listserv.ActiveState.com>
Sent: Friday, April 29, 2005 7:23 PM
Subject: RE: captive cursor


>
> > > >
> > > > I have created a program with a few controls including a text
> > > > field, but if
> > > > I move the focus to that text field (or rich edit) I cannot
> > > > move the focus
> > > > to another control using the tab key, but only the mouse.
> > > >
>
>
> For the RichEdit, there may be a more elegant way, but since tab is a
valid
> character it won't know to go to another widget unless you tell it to. I
> would do something like this:
>
> sub RichEdit_KeyPress   ### Assuming this widget is named RichEdit
> {
> my($key) = @_;
>
> if($key == 9)
> {
> $Window->Otherwidget->SetFocus();
> }
> }
>
>
> For the textfield, well, that should just work assuming you have set
> tabstops on those widgets. Please show some code and we might be able to
> offer more help on why its not working.
>
> -Pete

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to