Your DisplayMenu() code: LPARAMETERS oMenuObj ** Define variables LOCAL nRow, nCol, lnThisX, lnThisY, lpCurPos, lcLongThisX, lcLongThisY, ; lpPos, lnScreenX, lnScreenY ** My codes to determine the bottom/left of the menu needs to be! DECLARE SHORT ClientToScreen IN WIN32API INTEGER hWnd, STRING @lpPoint DECLARE SHORT ScreenToClient IN WIN32API INTEGER hWnd, STRING @lpPoint DECLARE SetCursorPos IN WIN32API INTEGER X, INTEGER Y DECLARE GetCursorPos IN WIN32API STRING @lpPoint lnThisX = oMenuObj.Left lnThisY = oMenuObj.Top + oMenuObj.Height *& Original Cursor Position!!!!! lpCurPos = SPACE(8) GetCursorPos(@lpCurPos) *& *& Decode thes Number type values into Long data type. lcLongThisX = NumToLong(lnThisX) lcLongThisY = NumToLong(lnThisY) *& *& Construct a POINT structure for ClientToScreen API call. lpPos = lcLongThisX+lcLongThisY *& *& Convert client coordinates to screen coordinates. ClientToScreen(Thisform.HWnd, @lpPos) *& lnScreenX = LongToNum(LEFT(lpPos, 4)) lnScreenY = LongToNum(RIGHT(lpPos, 4)) *& = SetCursorPos(lnScreenX, lnScreenY) *& nRow = MROW() nCol = MCOL() *& *& Move the cursor back to where it used to be!!! lnScreenX = LongToNum(LEFT(lpCurPos, 4)) lnScreenY = LongToNum(RIGHT(lpCurPos, 4)) = SetCursorPos(lnScreenX, lnScreenY) ** Define the popup at the oMenuObj's bottom/left DEFINE POPUP ShortCuts FROM nRow, nCol IN SCREEN SHORTCUT ... ... ...Supporting functions:
FUNCTION NumToLong LPARAMETER tnNum DECLARE RtlMoveMemory IN WIN32API AS RtlCopyLong ; STRING @pDestString, INTEGER @pVoidSource, INTEGER nLength LOCAL cString cString = SPACE(4) = RtlCopyLong(@cString, BITOR(tnNum,0), 4) RETURN cString ENDFUNC FUNCTION LongToNum LPARAMETER tcLong DECLARE RtlMoveMemory IN WIN32API AS RtlCopyLong ; INTEGER @ DestNum, ; STRING @ pVoidSource, ; INTEGER nLength LOCAL nNum nNum = 0 = RtlCopyLong(@nNum, tcLong, 4) RETURN nNum ENDFUNC>I'v create a toolbar button class that pops up a menu just like MS Outlook does.
> >.aMenuInfo[1,1] = "Open Client" && Prompt >.aMenuInfo[1,2] = "Images\Menu\Client.Bmp" && Image >.aMenuInfo[1,3] = "Opens an existing Client" && Tooltip text > >>
>WITH This > > IF .Enabled > .DisplayMenu(This) > ENDIF > > ENDWITH > >RETURN > > >>
> > >LPARAMETERS oMenuObj > > ** Define variables > LOCAL nBar, cPrompt > > WITH This > > ** Determine top/left of the menu > nRow = MROW() + 1 > nCol = MCOL() - 7.5 > > ** Define the popup > DEFINE POPUP ShortCuts FROM nRow, nCol IN SCREEN SHORTCUT > > ** Loop once for each menu item in the array > FOR nBar = 1 TO ALEN(.aMenuInfo, 1) > > ** Extract the prompt and the picture > cPrompt = .aMenuInfo[nBar, 1] > cPicture = .aMenuInfo[nBar, 2] > > ** If the prompt is empty, make it a separator > IF EMPTY(cPrompt) > DEFINE BAR nBar OF ShortCuts PROMPT "\-" > ELSE > DEFINE BAR nBar OF ShortCuts PROMPT cPrompt PICTURE cPicture > ENDIF > > ENDFOR > > ** Define selection actions > ON SELECTION POPUP ShortCuts oMenuObj.MenuSelect() > > ** Show the popup > ACTIVATE POPUP ShortCuts > > ENDWITH > >RETURN > >