[futurebasic] Re: [FB] Working with Menus

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

From: Robert Purves <listrp@...>
Date: Sun, 13 Dec 2009 15:39:41 +1300
Max Taylor wrote:

> Using CarbonEvents all of my Menu Key "Commands" work correctly but the mouse will not pull down the menus. They just sit there.

That's a puzzle; I don't even know how to produce that effect deliberately. Do you have any CE handlers installed on the menus themselves? 

> Since converting over to CarbonEvents I can also not seem to find "thePart" that I used to find in the following way. I realize that the "where" (_kEventParamMouseLocation) is picked up using the following line.
> 
> This may not be the same as the ".where" in the FindWindow function below
> fn GetEventParameter( theEvent, _kEventParamMouseLocation, _typeHIPoint, #0, sizeof( pt ), #0, @pt )
> so that pt.x and pt.y contains the point which IS picked up.
> 
> What code would be used in place of the following line to get the part of a window that a click occurs in.
> thePart = fn FindWindow( #gEventRecPtr.Where, WindowPtr  )
> 
> I have a feeling that the "FindWindow" function is not correct here and there must be something new, maybe.
> I need to detect a click in "case _InMenuBar" so that I can update menu items according to the context required at the time of the click. Like if there is no window open the the "Close", "Save" or "Save As", etc. should be dimmed.


FindWindow() has no good role in an OS X application. See FB_5_4_2_Examples > FBShell, which shows the CarbonEvent way to update menus, by installing handlers for {_kEventClassCommand, _kEventCommandUpdateStatus} on the application and the windows.

Robert P.