PDA

View Full Version : Routines for Popuping up PopupMenus



Raveen Ryan Sundram
3-Mar-2005, 08:20 PM
// To Popup a PopupMenu align at the left, bottom of a ToolButton
Procedure LocateAtParentPosition
Integer iVoid iLeft iTop iBottom iObj
String sRect
Pointer lpsRect

Get Invoking_Object_ID To iObj // ToolBar Object-ID

ZeroType tRect To sRect
GetAddress Of sRect To lpsRect

// get bounding rectangle of the button
Send Windows_Message To iObj TB_GETITEMRECT 1 lpsRect //TB_GETITEMRECT,
Zero-Based ToolButton Number, lpsRect
GetBuff From sRect At tRect.Bottom To iBottom
Put iBottom To sRect At tRect.Top

// convert Client to Screen coordinates
Move (ClientToScreen(window_handle(iObj), lpsRect)) To iVoid
GetBuff From sRect At tRect.Left To iLeft
GetBuff From sRect At tRect.top To iTop

Set GuiLocation To iTop iLeft
Send Adjust_Logicals
End_Procedure

// To Popup a PopupMenu at mouse location
Procedure LocateAtMousePosition
Integer loc
Get Absolute_Mouse_Location Of Desktop To Loc
Set GuiLocation To (Hi(loc)) (Low(loc))
Send Adjust_Logicals
End_Procedure

--
Regards,
Raveen Ryan Sundram
Excellent Software Ltd