[futurebasic] Re: [FB] Menu Highlighting

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2006 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Mon, 1 Jan 2007 10:59:54 +1300
maxclass@... wrote:

> Neither of the suggestions worked. Without posting tons of code as  
> examples I'll say this. I am not using DIALOG functions to trap  
> every event from the system. I'm simply picking up events on my  
> own. If it is a mouse click I find out the "where" then via a  
> SELECT check for CASE _InMenuBar, then use FN menuselect to get the  
> menu choice selected.
>
> Everything works beautifully except that even using "HiliteMenu 
> ( 0 ) and MENU statements at the end of the CASE the menu is still  
> selected (hilited) until you click the mouse in it one more time.

"Simply picking up events on my own" fails to convey a precise  
description. I'm guessing that you mean something similar to the demo  
below, in which case you should null out (ev.what = 0) events that  
are handled by MyDoEvent.

Robert P.

'-----------------------------
#define WindowPartCode as SInt16

local fn MyDoEvent
'~'1
dim ev as ^EventRecord
dim as WindowPartCode whatPart
dim as WindowRef @ evntWnd
dim as Point menuSel

ev = event
select ev.what
case _mButDwnEvt
whatPart = fn FindWindow( #ev.where, @evntWnd )
select whatPart
case _inMenuBar
// track the mouse and highlight the menu item
menuSel = fn MenuSelect( #ev.where )
// for demo purposes, indicate the menu choice
print menuSel.h%, menuSel.v%
// unhighlight the menu item
HiliteMenu( 0 )
// null the event so the FB runtime doesn't try to handle it
ev.what = 0
end select

end select
end fn

menu 1, 0, 1, "File"
menu 1, 1, 1, "Something"

on event fn MyDoEvent
print "Choose Something from File menu"
do
HandleEvents
until ( 0 )
'------------------------------