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

Re: Check mark on menu bar pull down item?

Eric Frans wrote:
> Hello IDL folks,
> I have looked through the documentation for IDL 5.1 and can't seem to
> find any mention of how to display a check mark next to a pull down item
> from a menu bar.  It looks like IDL leaves room on the left of menu bar
> pull down items for this purpose, but I can't figure out how to
> implement it.  I hope this is possible because it would be a lot slicker
> than having to use check boxes in the main widget area to indicate that
> certain options are on or off.
> As always, thanks in advance for any help!
>         - Eric Frans

One easy way around this problem is to leave extra space at the 
beginning of the text for the VALUE keyword for each button (the
text displayed in the pulldown menu), and then later change the
text so it begins with '*' or whatever character you like:

  button = WIDGET_BUTTON(base, VALUE='   This is the first button', ...

and then later when you want to "check" this menu button:

  widget_control, button, get_value=button_string
  str = ' * '     ; or str = '   ' to "uncheck"
  strput, button_string, str, 0
  widget_control, button, set_value=button_string

Since checking/unchecking usually means a toggle of some kind, this is
pretty straightforward.


    David S. Foster         Univ. of California, San Diego
     Programmer/Analyst     Brain Image Analysis Laboratory
     foster@bial1.ucsd.edu  Department of Psychiatry
     (619) 622-5892         8950 Via La Jolla Drive, Suite 2240
                            La Jolla, CA  92037