FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Popup menu, re-selecting required menu item
Posts: 47
Joined: Thu Jul 13, 2006 02:39 PM
Popup menu, re-selecting required menu item
Posted: Tue Jul 07, 2009 06:57 AM

Hi Antonio

Pop up menus by default open with no menu item selected. I wish to specify the item that must be pre-selected when the menu opens.
If I use oMenu:HiLite(1) to highlight the first menu item when the pop menu opens, it does highlight the 1st item correctly.
However - if I then use the kepboard to move to a different item e.g. item 2, I have to press the down key TWICE to move to it instead of once as expected
i.e. using HiLite works but does not seem to set some oMenu internal variable correctly, so keyboard handling thereafter is wrong

I am calling ::HiLite as follows via the 1st item bWhen as there are no event blocks in the activate method

    MENU oMenu  POPUP
      MENUITEM "&Increment previous reference" ACTION nChoice    := 1
      MENUITEM "&Copy previous reference" ACTION nChoice    := 2
      SEPARATOR
      MENUITEM "C&ancel" ACTION nChoice := 0
    EndMENU

    nChoice              := 1
    oMenu:aItems[ 1 ]:bWhen   := { || oMenu:oWnd := poGet, oMenu:Hilite( 1 ), oMenu:aItems[ 1 ]:bWhen := nil, .t. }
    ACTIVATE POPUP oMenu WINDOW poGet

Your assistance would be appreciated
Thanks, Peter

Peter

Continue the discussion