DEFINE POPUP mnuXXX SHORTCUT RELATIVE FROM MROW(), MCOL(), the mrow() and mCol()values are in FOXELS. If you try to reposition the menu relative to an object on the screen, it becomes difficult to manage, as the object positions are in PIXELS. Has anybody a UDF to convert from PIXELS to FOXELS, ?
***********************************************
function Pix2Fox
************************************************
lparameters nTop, nLeft, oObj
* convert a top/left pixel pair into a row/column pair based on font of object.
* callers responsibility to ensure oObj has font attributes.
* pass nTop and nLeft by reference
nTop= round(nTop/fontmetric(1, oObj.fontname, oObj.fontsize, OStyle2Style(m.oObj)), 3)
nLeft= round(nLeft/fontmetric(6, oObj.fontname, oObj.fontsize, OStyle2Style(m.oObj)), 3)
************************************************
function OStyle2Style
************************************************
lparameter oTxt
* Convert an objects text style to a Fontmetric Style
local cS
with oTxt
if .fontbold
cS= "B"
else
cS= "N"
endif
if .fontitalic
cS= m.cS + "I"
endif
if .fontoutline
cS= m.cS + "O"
endif
if .fontshadow
cS= m.cS + "S"
endif
if .fontstrikethru
cS= m.cS + "-"
endif
if .fontunderline
cS= m.cS + "U"
endif
if type(".Backstyle")="N" and .backstyle = 0
cS= m.cS + "T"
endif
endwith
return m.cS