[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MBAR



Hello,

I'm not sure that it is possible to have the Menu Bar have non-menu buttons.
The online help states that, 'This widget ID can then be used to fill
the menubar with pulldown menus.'  

You can modify the code slightly (shown below) to make a mock menu bar. 
I just tried the following on a MAC; it looks slightly different than
the typical menu bar (created by the top level widget base) but it
performs as you wish.

Ben


;------START HERE

pro my_menu_event, ev

  widget_control,  ev.id,  get_uvalue=uval

  case uval of
    'OPEN'  : print, uval
    'PRINT' : print, uval
    'DONE'  : widget_control, ev.top, /destroy
    else    :
  endcase

end


pro my_menu
		;create the base widget without retrieving a menu bar widget.
  base       = WIDGET_BASE(TITLE = 'My Menu')		

		;create your own base widget to serves as the menu bar
  bar = WIDGET_BASE(base, ROW = 1)
  
  f_menu     = WIDGET_BUTTON(bar, VALUE='File',  /MENU)
  file_open  = WIDGET_BUTTON(f_menu, VALUE='Open',  UVALUE='OPEN')
  file_print = WIDGET_BUTTON(f_menu, VALUE='Print', UVALUE='PRINT')
  file_done  = WIDGET_BUTTON(f_menu, VALUE='Done',  UVALUE='DONE')

  bttn1=WIDGET_BUTTON(bar, VALUE='Done',UVALUE='DONE')

  widget_control, base, /realize
  xmanager,  'my_menu',  base

end
;-------------END HERE

Ben

"Dominic R. Scales" wrote:
> 
> Hi all,
> 
>   I have a question regarding MBAR:
>     is it possible to have an entry at the main level of mbar
>     acting as simple button and not as start of a menu?
>     or
>     How do I make the 'Done'-button bttn1 do what it is supposed to?
> 
> Cheers,
>        Dominic
> 
> P.S. and..., oh yes, /MENU seems to be the default

-- 
Ben Tupper
Bigelow Laboratory for Ocean Sciences
180 McKown Point Rd.
W. Boothbay Harbor, ME 04575
btupper@bigelow.org