Re: Tree Widgets and COntext Menus [message #52998] |
Wed, 14 March 2007 09:01 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
aric911 writes:
> I am trying to create a tree widget with context menus. I keep running
> into problems with the menu's base. To give you an idea of what i am
> doing I have a structure similar to the following:
>
>
> base1 = WIDGET_BASE()
>
> tree = WIDGET_TREE(base1)
>
> menu = WIDGET_BASE(tree, /CONTEXT_MENU)
> menuOpt = WIDGET_BUTTON(menu, VALUE='HELLO WORLD')
> menuOpt1 = WIDGET_BUTTON(menu, VALUE='HELLO WORLD1')
>
>
> If i do it that way then I get extra nodes in my tree....which are
> essentially the context menu widgets. If I make the parent of the menu
> base1 then the widget layout gets messed up. Does anybody have any
> ideas why I can't create a menu off tree or first base widget?
>
> I have seen examples of where you have to do the following....
> base1 = WIDGET_BASE()
> base2 = WIDGET_BASE(base1)
> tree = WIDGET_TREE(base1)
>
> menu = WIDGET_BASE(base2, /CONTEXT_MENU)
> menuOpt = WIDGET_BUTTON(menu, VALUE='HELLO WORLD')
> menuOpt1 = WIDGET_BUTTON(menu, VALUE='HELLO WORLD1')
>
> With this solution though you have to introduce an unnecessary base
> widget and I would like to avoid that.
I'm guessing you want to avoid it because it gives the
appearance of there being an extra base there. This is
because bases now "take up space", at least they do in
Windows XP. I have gotten to the point where I almost
always create base widgets, especially those that only
serve as GUI organizers in my program, like this:
base_container = Widget_Base(id, XPAD=0, YPAD=0, SPACE=0)
This tends to solve the unsightly expansion of your GUI by
using extra bases.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|