Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

How to add new items into the the option menu created by tk_optionMenu?


How to add new items into the the option menu created by
tk_optionMenu?
Thanks a lot!
I found the way to insert new items into option menu.
set opt [tk_optionMenu ...]
$opt insert end radiobutton -label ...

Now my question is how to select the first itme after inserting all
the items.
I tried
$opt select 0
and it doesn't work.

Appreciate your help.

hjin wrote:
> How to add new items into the the option menu created by
> tk_optionMenu?
> Thanks a lot!

As described by the man page, tk_optionMenu returns the path to the menu
associated with the optionMenu. Once you get the menu name you can use
normal menu commands.

   set menu [tk_optionMenu .om whatever red green blue]
   $menu insert end separator
   $menu insert end command -label "Hello, world"
   pack .om

--
Bryan Oakley
http://www.tclscripting.com

On May 9, 2:43 pm, Bryan Oakley <oak@bardo.clearlight.com> wrote:

Could you tell me how to select the first item?
I tried "$menu select 0" and it failed.
Thanks a lot!

The menu is only visible when you click on the widget, so selecting
it doesn't really do anything on it's own, the menubutton is what is
visible. When you create the option menu, you give it a variable, just
set that variable to the value you want and the widget will update
appropriately.

Bruce

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc