Can "Tab" be disabled? 
Author Message
 Can "Tab" be disabled?

Hi all,

I am using an entry widget to display a directory name.  I want to add
file completion to this widget through the use of the "Tab" key.
Meaning, if you hit the tab key inside the entry widget it will
autocomplete the filename for you.

The problem I am seeing is everytime I hit the tab key my Callback is
envoked, but I also lose the focus on the entry widget.  (It jumps to
the next widget).   I want the focus to remain inside the entry widget
each time tab is pushed.  I have tried to force the focus so it remains
on my entry widget inside the bind routine, but nothing seems to work.

< inside the Callback >

    $entry->focus;                                                  <--
This doesn't work.  It doesn't do anything I can see anyway.
    $entry->configure(-state => 'active');     <-- Even thou the
Perl/TK book says this is valid, it returns an error stating "active is
not a valid choice"

Is there a way to disable the tab key for any given widget?  Or how does
one force the focus to remain on a widget?

I know I could get by simply by choosing another key other than "Tab"
for the file complete, but that isn't an option currently.....

Any help is appreciated.  Thanks!

Jeremy

--
Jeremy Salsman -- Verification Technology
Office:  040-3 / C301
Phone: (507) 253-0779 T/L: 8-553-0779



Sun, 07 Jul 2002 03:00:00 GMT  
 Can "Tab" be disabled?

I turns out this is easily done outside of the Callback routine using
the FocusOut event...

$entry->bind("<FocusOut>", sub { $entry->focus() });

-------------------------------------------------

Quote:

> Hi all,

> I am using an entry widget to display a directory name.  I want to add
> file completion to this widget through the use of the "Tab" key.
> Meaning, if you hit the tab key inside the entry widget it will
> autocomplete the filename for you.

> The problem I am seeing is everytime I hit the tab key my Callback is
> envoked, but I also lose the focus on the entry widget.  (It jumps to
> the next widget).   I want the focus to remain inside the entry widget
> each time tab is pushed.  I have tried to force the focus so it
> remains on my entry widget inside the bind routine, but nothing seems
> to work.

> < inside the Callback >

>     $entry->focus;
> <-- This doesn't work.  It doesn't do anything I can see anyway.
>     $entry->configure(-state => 'active');     <-- Even thou the
> Perl/TK book says this is valid, it returns an error stating "active
> is not a valid choice"

> Is there a way to disable the tab key for any given widget?  Or how
> does one force the focus to remain on a widget?

> I know I could get by simply by choosing another key other than "Tab"
> for the file complete, but that isn't an option currently.....

> Any help is appreciated.  Thanks!

> Jeremy

> --
> Jeremy Salsman -- Verification Technology
> Office:  040-3 / C301
> Phone: (507) 253-0779 T/L: 8-553-0779




Tue, 09 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Disable Win32 system() "enhancements"

2. Disabling "Taintedness" of variables

3. Disable Apache shebang line "feature"?

4. Perl "Here" document and formatting tabs

5. Text() ignored bind("<Tab>")

6. Problem tabbing between items in "Table"

7. I am an "antispam spammer"?

8. "character class ""bug""

9. system(("cp", "-Rf", "/tmp/a/*", "/tmp/b")); doesnt wrk

10. how to parse a "this", "that", "and the ", "other" file

11. s"\n+$"" s"\n*$""

12. how to safely substitute a "(", ")" or "["

 

 
Powered by phpBB® Forum Software