[futurebasic] Re: [FB] IB pop up menu handle

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Tue, 26 Feb 2008 17:34:57 +1300
Ken Shmidheiser wrote:
> David asked:
>> ...in this case I have converted the nib items to FB buttons- not  
>> sure how you would do it in HIVIEW
> In IB, assign your menu a signature and id. Then you can get its  
> MenuRef (AKA "handle") with:
> MenuRef HIMenuViewGetMenu ( HIViewRef inView )


AFAIK, the only way to get a popup button's MenuRef is with  
GetControlData either directly:
> err = fn GetControlData( theControlRef, _kControlMenuPart,  
> _kControlPopupButtonMenuRefTag, sizeof( MenuRef ), @theMenuRef, #0 )
or via the FB wrapper:
def GetButtonData( myBtnNum, _kControlMenuPart,  
_kControlPopupButtonMenuRefTag, sizeof( MenuRef ), @theMenuRef, #0 )


HIMenuViewGetMenu() is, er, something else:

  *  HIMenuViewGetMenu()
  *
  *  Summary:
  *    Returns the MenuRef that is associated with an HIView that is a
  *    subclass of HIMenuView.
  *
  *  Discussion:
  *    An HIMenuView subclass might use this API to determine the menu
  *    that it should draw. Prior to Mac OS X 10.5, this API returns
  *    NULL if passed an instance of the standard menu view. In Mac OS X
  *    10.5 and later, this API correctly returns the owning menu of an
  *    instance of the standard menu view.


Robert P.