[Top][All Lists]

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

Re: Unselect Menu Cursor?

From: Michael B. Allen
Subject: Re: Unselect Menu Cursor?
Date: Mon, 23 Apr 2001 00:22:11 -0400

On Mon, Apr 23, 2001 at 12:47:20AM +0200, Jürgen Pfeifer wrote:
> > > Can a menu's cursor turned off momentarily? I have two 
> > menus on the same
> > > screen and would like only one to have a cursor at any given time.
> > 
> > I'm not sure what you're asking:  there's only one text 
> > cursor on the screen,
> > and that generally displays at the last-updated location (or 
> > the point where a
> > program is requesting input).
> > 
> I guess he means the highlighting done for the current item in
> a menu. With pos_menu_cursor() you can force the "physical"
> cursor to be set to the selected item in the menu. But of
> course if you've multiple menu's with selected items on the
> screen they all stay highlighted. The only way to change this
> is to write some application code that changes the highlighting
> of the selected items in the non-active menus. One should use
> the menu_fore(), menu_back() and menu_grey() functions for that
> purpose.

This worked perfectly Jürgen:

    case '\t':
        if (active_menu == 0) { 
            set_menu_fore(m0, A_NORMAL);
            active_menu = 1;
        } else {
            set_menu_fore(m0, A_STANDOUT);
            active = 0;

You'll notice that I do not turn off the menu cursor for the second menu
because it is acting as a make-shift table(see screen below) and felt
only the command menu on the left should have it's menu deavtivated(My
alternative until now was to save the selected menu item and change the
menu cursor position to an non-O_SELECTABLE menu header(position 0). Then
I would switch it back. Pretty ugly).

  MENU 0                    MENU 1

 Command          Path               Name   <---- non-O_SELECTABLE
 Edit             <home directories> homes
-Add              /tmp               tmp
 Delete           /scratch           public
                 -/share1++++++++++++yo++++ <---- '+' means highlighted

The hash '-' mark on the inactive menu is a nice touch. Also your mention
of pos_menu_cursor solved another little detail. When moving from one
menu to the other the pysical cursor would be left on the inavtive
menu. Calling pos_menu_cursor on the now active menu clears up that
little visual impurity. All in all I'd say this works quite well but
there is still one little problem; the foreground color is initially
white. However after calling set_menu_fore with A_STANDOUT the foreground
color becomes blue. I suspect I should be setting the color attributes
during initialisation?


signature pending

reply via email to

[Prev in Thread] Current Thread [Next in Thread]