From: Ravikanth on
Hi all,

I have a doubt as to how to disable a command added to menubutton
menu.

Let me explain it more clealry with a sample code

menubutton .mbar -text "TEST" -menu .mbar.a
..mbar
menu .mbar.a -tearoff no
..mbar.a add command -label "Test1"
..mbar.a add command -label "Test2"
..mbar.a add command -label "Test3"
pack .mbar

If for some reason i need to disable command with label "Test1" &
"Test2" and keep in active state only "Test3" how can i do it and also
later if i want to enable the command with labels "Test1" and "Test2"
how to do it.

Please guide me how to acheive this.

Thanks in advance,
Ravikanth

From: billposer on
You use the entryconfigure widget command with the index of the menu
item as its first argument, like this:

..mbar.a entryconfigure 1 -state disabled

This disables the second menu item, the one labelled "Test2". Note
that entries are indexed from 0, but that the first entry is occupied
by the tearoff if there is one. If you were to set -tearoff 1 above,
the entryconfigure command would disable "Test1" rather than "Test2".

Bill
From: Ralf Fassel on
* billposer(a)alum.mit.edu
| Note that entries are indexed from 0, but that the first entry is
| occupied by the tearoff if there is one. If you were to set -tearoff
| 1 above, the entryconfigure command would disable "Test1" rather
| than "Test2".

Note that you can use the labels as index:

.mbar.a entryconfigure "Test2" -state disabled

R'
From: Ravikanth on
On Jun 24, 12:58 pm, Ralf Fassel <ralf...(a)gmx.de> wrote:
> * billpo...(a)alum.mit.edu
> | Note that entries are indexed from 0, but that the first entry is
> | occupied by the tearoff if there is one. If you were to set -tearoff
> | 1 above, the entryconfigure command would disable "Test1" rather
> | than "Test2".
>
> Note that you can use the labels as index:
>
> .mbar.a entryconfigure "Test2" -state disabled
>
> R'

Bill & Ralf,

Thanks a lot for your guidance.