[futurebasic] Re: [FB] Hierarchical popup menus in Appearance runtime

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2004 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Fri, 28 May 2004 14:15:45 +1200
Alain Pastor wrote:

> Paul Bruneau wrote:
>
>> But I'm having trouble with Appearance popups. I want to use the 
>> correct method, and am doing something like this:
>> First, the definition of the popup "button" in appearance:
>> appearance button _myBevelButton,, _theResMenu, 0, 0, "Popup", @r, 
>> _kControlBevelButtonSmallBevelProc
>> Then, here is the code that retrieves what the user selected (it is 
>> in a Dialog (event) select structure):
>> button( _myBevelButton, _fbGetBevelControlMenuVal )
>> This gets the item just fine. The problem is, how do I find out what 
>> submenu might have been selected?
>> Does anyone have any Appearance popup submenu code they'd be willing 
>> to share? Or a toolbox call they can point me to?
>
>
> Here is what I use in QuiXample where I have two popup bevel buttons, 
> one of them including a hierarchical submenu. I'm not sure this is the 
> best method but maybe you can do something out of it. I will simplify 
> the code:
< snip>

I would simplify it even more, by gathering the required information 
with the extended button function (instead of def GetButtonData), and 
by *not* synthesising a fake menu event: just handle the original 
_btnClick event directly in DoDialog.

local fn DoDialog
'~'1
dim as long    evnt, ref
dim as short   menuID, menuItem

evnt = dialog( 0 )
ref  = dialog( evnt )

select evnt
case _btnClick
select ref
case _myBevelBtn
menuID   = button( ref, _FBGetBevelControlLastMenu )
menuItem = button( ref, _FBGetBevelControlMenuVal )
// perform some action, based on ref, menuID and menuItem
print "Bevel button" ref "   menuID" menuID "   item" menuItem

end select
end select
end fn


Robert P.