Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

A question to focus-method and bind
Hi Folks

I've some question to the focus-method and bind.

see this little code:

$entry->bind("<KeyPress-Tab>",sub { check_entry();});

in the check_entry subroutine the entered value will be tested, and if
test fails the value will be cleared.
in this case I do the following:

$entry->focus();

the focus should be returned to the $entry-widget, but it doesnt't works
so.

Why ??

Thanks
Pit



Report this thread to moderator Post Follow-up to this message
Old Post
Pit
09-23-04 01:56 PM


Re: A question to focus-method and bind
"Pit" <pharrendorf@am-soft.de> wrote in message
 news:47e6855e20101a25fbbd1cb956d80837@lo
calhost.talkaboutprogramming.com...
> Hi Folks
>
> I've some question to the focus-method and bind.
>
> see this little code:
>
> $entry->bind("<KeyPress-Tab>",sub { check_entry();});
>
> in the check_entry subroutine the entered value will be tested, and if
> test fails the value will be cleared.
> in this case I do the following:
>
> $entry->focus();
>
> the focus should be returned to the $entry-widget, but it doesnt't works
> so.
>
> Why ??

Likely because the default binding for a tab on a MainWindow is to
"focusNext". i.e. that is how you move focus from widget to widget without
using the mouse. An easy bandaid fix is to either adjust your binding to a
KeyRelease-Tab (untested) or just delay your command with "after". The
latter will mean that the focus will shift to the next widget for a very
brief period before being reset to your entry.

sub validate_your_entry {
blah blah

$entry->after(75,sub{$entry->focus});
return 1;
}

Jack



Report this thread to moderator Post Follow-up to this message
Old Post
Jack D
09-24-04 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PerlTk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.