Shortcut keys for drop-down menus 
Author Message
 Shortcut keys for drop-down menus

A week ago, I put up a posting that I had lost the functionality of my
drop-down shortcuts (Alt-F => File) when I upgraded from 8.0.5 to
8.1.1.  All responses to that problem claimed that it was something
system-dependant.  This posting is in reference to that.

First of all, I was able to isolate that the problem was version
dependant by running the "widget" binary in the ../lib/tk8.1/demos/
directory.  When I ran this with the tcl libraries from version 8.1
(specifically the Menubutton subheading -- which sources menubu.tcl) the
shortcut keys (Above, Below, Right, Left)did not work.  Specifically,
they couldn't find a string.  NOTE: the Alt-F shortcut to the File
dropdown on the table-of-contents page, which does not use menubuttons,
did work.  However, when I ran the same binary with the tcl libraries
from version 8.0, all the shortcuts worked fine.

I found one statement (of importance) that differed between the 8.0
version of menu.tcl and the 8.1 version of menu.tcl.  This was found on
line 937 of the file and contained the statement

                  if {[string compare [$child cget $i -state]
"disabled"]} {
                       return $child
                   }

is this syntactically correct?  I replaced it with the command that was
used in the 8.0 version:

                    if {[$child cget -state] != "disabled"} {
                        return $child
                    }

and things work right everywhere.  Now, that the this question is no
longer of any imperative nature, I ask this out of curiousity rather
than necessity.  Why was this changed?  Can any of you run the
Menubutton (menubu.tcl) GUI from under widget without errors?
Any answers to this posting are appreciated.  Many thanks to the curious
out there.



Sat, 05 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus

Quote:

> I found one statement (of importance) that differed between the 8.0
> version of menu.tcl and the 8.1 version of menu.tcl.  This was found on
> line 937 of the file and contained the statement

>            if {[string compare [$child cget $i -state] "disabled"]} {
>                return $child
>            }

> is this syntactically correct?  I replaced it with the command that was

        ...

The "disabled" should be on the same line, but you are correct that
the $i there is extraneous.  You only need to remove that var.
However, I am still confused as to what you when that is going to
trigger.  I can wander all over the menus of my app without hitting
this.  Exactly what sequence do you use when going through your menu
buttons to trigger this?  BTW, I'll send the patch to Scriptics.


**  I'm really just a Tcl-bot    My opinions are MY opinions  **

  Jeffrey.Hobbs.vcf
< 1K Download


Sun, 06 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus


:A week ago, I put up a posting that I had lost the functionality of my

Here are some of my experiences.  I am using an Ultra 5/Solaris 2.6 running
CDE.

Using Tcl/Tk 8.0.5, my Alt-F key works fine in the Tk widget tour demo.
However, my Meta-Q key does NOT work.  I get the same behavior from
TclPro prowish8.0 release 1.1 and 1.2.

I see the same behavior under Tcl/Tk 8.1.1 and Tcl/Tk 8.2b2 .

At one time, there was a piece of Tk code floating about which would
generate the key name and modifier for keystrokes pressed within a
tk widget.  I don't see it laying about my disk - does anyone have this?

I know about xev - xev says I am pressing a meta q.  I want to know if
Tk thinks I am pressing a meta q...

P.S.  the widget demo has a copyright date of 96 and 97.  Perhaps the
date, and some of the code, should be updated to reflect any changes
since that time?
--

<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.



Sun, 06 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus

Quote:

> However, I am still confused as to what you when that is going to
> trigger.  I can wander all over the menus of my app without hitting
> this.  Exactly what sequence do you use when going through your menu
> buttons to trigger this?  BTW, I'll send the patch to Scriptics.

When I'm on the Menu Button Demonstration, that error was triggered when I
tried Alt-B or Alt-L (Code from line 11 of menubu.tcl).  I get the stack
trace after hitting the shortcut keys; the sub-menus are never displayed.

menubutton $w.body.below -text "Below" -underline 0 -direction below -menu
$w.body.below.m -relief raised
menu $w.body.below.m -tearoff 0
$w.body.below.m add command -label "Below menu: first item" -command "puts
\"You have selected the first item from the Below menu.\""
$w.body.below.m add command -label "Below menu: second item" -command "puts
\"You have selected the second item from the Below menu.\""

Note:  If it helps, the drop-down menu in my app was created with
menubuttons, not the menu command.  This agrees with with the errors that
I experience in ./widget with the menubuttons but not the file menu (which
doesn't use menubuttons)



Sun, 06 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus

Quote:

> When I'm on the Menu Button Demonstration, that error was triggered when I
> tried Alt-B or Alt-L (Code from line 11 of menubu.tcl).  I get the stack
> trace after hitting the shortcut keys; the sub-menus are never displayed.

Sorry, I guess that was unclear.  I got the error if I tried to use ANY
shortcut on Menu Button Demonstration file.  The stack trace might be more
helpful than the code snippet that I gave...  I had forgotten that I had saved
it...   heregoes~~

----------------
can't read "i": no such variable
    while executing
"$child cget $i -state"
    ("Menubutton" arm line 5)
    invoked from within
"switch [winfo class $child] {
            Menubutton {
                set char2 [string index [$child cget -text]  [$child cget
-underline]]
              if {![string co..."
    (procedure "tkMenuFind" line 39)
    invoked from within
"tkMenuFind $child $char"
    ("default" arm line 2)
    invoked from within
"switch [winfo class $child] {
            Menubutton {
                set char2 [string index [$child cget -text]  [$child cget
-underline]]
              if {![string co..."
    (procedure "tkMenuFind" line 39)
    invoked from within
"tkMenuFind [winfo toplevel $w] $char"
    (procedure "tkTraverseToMenu" line 16)
    invoked from within
"tkTraverseToMenu .menubutton b"
    (command bound to event)
---------------



Sun, 06 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus

Quote:


> :A week ago, I put up a posting that I had lost the functionality of my
> Here are some of my experiences.  I am using an Ultra 5/Solaris 2.6 running
> CDE.

I'm using HPUX 10.20, VUE 3.0 (or something). demos.tcl doesn't work on 8.0 or
8.1 (the Alt-F, I mean).

Quote:
> At one time, there was a piece of Tk code floating about which would
> generate the key name and modifier for keystrokes pressed within a
> tk widget.  I don't see it laying about my disk - does anyone have this?

should be fairly easy to write:

button .b -width 40
bind .b <KeyPress> ".b configure -text %K"
pack .b

Hmmm... although it doesn't show modifiers *with* the keys. In my case,
pressing alt_f gives "hpguilder", whatever that is....

L

--
Penguin Power!           Nothing I say reflects the views of my employer


CGI - FWFM Project                                 Phone: (514) 391-9523



Sun, 06 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus


:> At one time, there was a piece of Tk code floating about which would
:> generate the key name and modifier for keystrokes pressed within a
:> tk widget.  I don't see it laying about my disk - does anyone have this?
:
:should be fairly easy to write:
:
 button .b -width 40
 bind .b <KeyPress> ".b configure -text %K"
 pack .b
:
:Hmmm... although it doesn't show modifiers *with* the keys. In my case,
:pressing alt_f gives "hpguilder", whatever that is....

Hmm - I don't get anything on my keyboard...

--

<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.



Sun, 06 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus

Quote:

> Hmmm... although it doesn't show modifiers *with* the keys. In my case,
> pressing alt_f gives "hpguilder", whatever that is....

Wild guess: "hp" is the manufacturer, possibly indicating a non-standard
extension of character set. "guilder", a.k.a florin, hfl, NLG, is the
Dutch currency, soon to be Euroized. They have a special currency
symbol, \u0192 LATIN SMALL LETTER SCRIPT F, looking somehow like the
longish holes in a violin. That a keysym table maps this particular
character to Alt-F seems almost plausible.
Every now and then, the Unicode is a Good Thing ;-)

BTW: on my Sun with Tcl 8.0.6, the keysyms "Alt_L" and "f" come in
sequence, and the File menu pops up.
--
Schoene Gruesse/best regards, Richard Suchenwirth - tel. +49-7531-86
2703
RC DT2, Siemens Electrocom GmbH, Buecklestr. 1-5, D-78467 Konstanz,
Germany
Meet me at the Tcl'ers Wiki: http://mini.net/cgi-bin/wikit/496.html



Sun, 06 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus

Quote:

>  button .b -width 40
>  bind .b <KeyPress> ".b configure -text %K"
>  pack .b
> :
> :Hmmm... although it doesn't show modifiers *with* the keys. In my case,
> :pressing alt_f gives "hpguilder", whatever that is....
> Hmm - I don't get anything on my keyboard...

Make sure the button has focus.

L

--
Penguin Power!           Nothing I say reflects the views of my employer


CGI - FWFM Project                                 Phone: (514) 391-9523



Sun, 06 Jan 2002 03:00:00 GMT  
 Shortcut keys for drop-down menus


:BTW: on my Sun with Tcl 8.0.6, the keysyms "Alt_L" and "f" come in
:sequence, and the File menu pops up.

What about Meta-Q for quit - does it work on your machine?

--

<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.



Sun, 06 Jan 2002 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Arrow keys as shortcut for menu

2. VA Drop-down list problem with keys?

3. How to tell if menu selected/dropped down

4. how can i get a drop down menu or check list control

5. Auto-fill for drop down menu

6. get a ring menu to have drop down as well as manual input

7. add choices to drop down menu's

8. Odd problem with drop down menu

9. Converting javascript into php of a dhtml drop down menu

10. run time drop down menu elements (ala netscape's bookmarks)

11. WinXP - How to place image in line with drop-down menu

12. drop down menu

 

 
Powered by phpBB® Forum Software