Author | Topic: Return error on XbpMenu():currentPos() | |
---|---|---|
Carlos a Beling | Return error on XbpMenu():currentPos() on Sat, 08 Jan 2011 13:14:44 -0200 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> </head> <body bgcolor="#ffffff" text="#000000"> <tt>Good afternoon.<br> </tt><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: arial,sans-serif; font-size: 16px;"><tt><span title="Eu usei o programa OwnerDraw.prg e criei uma nova classe." style="background-color: rgb(255, 255, 255);">I used the program OwnerDraw.prg and created a new class.<span class="Apple-converted-space"> <br> I need to know a position of the menu item that is highlighted for to show a tip below it.<br> </span></span><span title="Estou tendo um problema porque seu método :currentPos()está retornando :currentpos()[02]" style="background-color: rgb(255, 255, 255);">The problem is that the method oXbpMenu:currentPos() is returning strange value in oXbpMenu:currentpos()[02]<span class="Apple-converted-space"></span></span><span title="inválida." style="background-color: rgb(255, 255, 255);">.<span class="Apple-converted-space"> </span><br> </span></tt><span title="Exibi a posição através dos comandos abaixo colocados em :drawItem()" style="background-color: rgb(255, 255, 255);"><tt>So, I displayed the positions in the oXbpMenu:setParent() in the method oXbpMenu:drawItem()<span class="Apple-converted-space"> </span>and I got the positions as follow:</tt><br> <br> </span><span title="cls" style="background-color: rgb(255, 255, 255);">cls<span class="Apple-converted-space"> <br> <tt>QOut('Mouse Position ', GetPointerPos()) ==> {160, 153} </tt><br> </span></span><tt><span title="QOut('Setparent() ', ::setParent()) ==> XbpCrt" style="background-color: rgb(255, 255, 255);">QOut('SetParent() ', ::SetParent ()) ==> XbpCrt<span class="Apple-converted-space"> </span><br> </span><span title="QOut('Setparent():currentpos()', ::setParent():currentPos()) ==> {152, 106}" style="background-color: rgb(255, 255, 255);">QOut('SetParent():currentpos()', ::SetParent():currentPos ()) ==> {152, 106}<span class="Apple-converted-space"> </span><br> </span><span title="QOut('oXbpMenu:CurrentPos() ', ::currentPos()) ==> {1, -345}" style="background-color: rgb(255, 255, 255);">QOut('oXbpMenu:CurrentPos() ', ::currentPos()) ==> {1, -345} <<<<<<<<<<span class="Apple-converted-space"> </span><br> </span></tt></span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: arial,sans-serif; font-size: 16px;"><span title="QOut('Bound rect ', aInfo[4]) ==> { 0, 1, 200, 24}" style="background-color: rgb(255, 255, 255);"><tt>QOut('Bound rect ', aInfo[4]) ==> {0, 1, 200, 24}</tt></span></span></span><br> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: arial,sans-serif; font-size: 16px;"><tt><span title="QOut('oXbpMenu:CurrentPos() ', ::currentPos()) ==> {1, -345}" style="background-color: rgb(255, 255, 255);"></span><span title="QOut('Item number ', aInfo[1]) ==> 18" style="background-color: rgb(255, 255, 255);">QOut('Item number ', aInfo[1]) ==> 18<span class="Apple-converted-space"> </span><br> </span><span title="QOut('Action ', aInfo[2]) ==> 1" style="background-color: rgb(255, 255, 255);">QOut('Action ', aInfo[2]) ==> 1<span class="Apple-converted-space"> </span><br> </span><span title="QOut('State ', aInfo[3]) ==> 256" style="background-color: rgb(255, 255, 255);">QOut('State ', aInfo[3]) ==> 256<span class="Apple-converted-space"> </span><br> </span></tt><span title="QOut('Bound rect ', aInfo[4]) ==> { 0, 1, 200, 24}" style="background-color: rgb(255, 255, 255);"><tt><span class="Apple-converted-space"></span></tt><br> </span><span title="É algum erro já conhecido, ou está correto?" style="background-color: rgb(255, 255, 255);">It is a bug already known, or I made some mistake?</span></span></span><br> <br> Beling<br> TIA<br> </body> </html> | |
Carlos a Beling | Re: Return error on XbpMenu():currentPos() - another issue on Mon, 10 Jan 2011 10:18:51 -0200 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> <br> Good morning:<br> trying to have the position of oXbpMenu() in the appdesktop() I used the function below:<br> <br> FUNCTION ApiGetXbpPosition_(oXbp)<br> // Return the position of <oXbp> in AppDeskTop(), in the format<br> // {nBottomX, nBottomY}<br> STATIC cCall<br> LOCAL cBinPos, nY, nDll<br> <br> if cCall == NIL<br> nDll := ApiLoadDll_('User32.dll')<br> cCall := DllPrepareCall(ndll, DLL_STDCALL, 'ClientToScreen')<br> endif<br> <br> cBinPos := Replicate(Chr(0), 8)<br> nY := ((AppDesktop():currentSize()[2] - 1) - oXbp:currentSize()[2])<br> DllExecuteCall(cCall, oXbp:getHWND(), @cBinPos)<br> RETURN {Bin2U(Left(cBinPos,4)), (nY - Bin2U(Right(cBinPos,4)))}<br> <br> The problem is that it always return {0, 515} indenpending on the oXbpMenu() position.<br> Please, what is wrong?<br> <br> Beling <br> HTH<br> <br> Em 8/1/2011 13:14, Carlos a Beling escreveu: <blockquote cite="mid:46a9d288$1592eac$6fbe7@news.alaska-software.com" type="cite"> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <tt>Good afternoon.<br> </tt><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: arial,sans-serif; font-size: 16px;"><tt><span title="Eu usei o programa OwnerDraw.prg e criei uma nova classe." style="background-color: rgb(255, 255, 255);">I used the program OwnerDraw.prg and created a new class.<span class="Apple-converted-space"> <br> I need to know a position of the menu item that is highlighted for to show a tip below it.<br> </span></span><span title="Estou tendo um problema porque seu método :currentPos()está retornando :currentpos()[02]" style="background-color: rgb(255, 255, 255);">The problem is that the method oXbpMenu:currentPos() is returning strange value in oXbpMenu:currentpos()[02]<span class="Apple-converted-space"></span></span><span title="inválida." style="background-color: rgb(255, 255, 255);">.<span class="Apple-converted-space"> </span><br> </span></tt><span title="Exibi a posição através dos comandos abaixo colocados em :drawItem()" style="background-color: rgb(255, 255, 255);"><tt>So, I displayed the positions in the oXbpMenu:setParent() in the method oXbpMenu:drawItem()<span class="Apple-converted-space"> </span>and I got the positions as follow:</tt><br> <br> </span><span title="cls" style="background-color: rgb(255, 255, 255);">cls<span class="Apple-converted-space"> <br> <tt>QOut('Mouse Position ', GetPointerPos()) ==> {160, 153} </tt><br> </span></span><tt><span title="QOut('Setparent() ', ::setParent()) ==> XbpCrt" style="background-color: rgb(255, 255, 255);">QOut('SetParent() ', ::SetParent ()) ==> XbpCrt<span class="Apple-converted-space"> </span><br> </span><span title="QOut('Setparent():currentpos()', ::setParent():currentPos()) ==> {152, 106}" style="background-color: rgb(255, 255, 255);">QOut('SetParent():currentpos()', ::SetParent():currentPos ()) ==> {152, 106}<span class="Apple-converted-space"> </span><br> </span><span title="QOut('oXbpMenu:CurrentPos() ', ::currentPos()) ==> {1, -345}" style="background-color: rgb(255, 255, 255);">QOut('oXbpMenu:CurrentPos() ', ::currentPos()) ==> {1, -345} <<<<<<<<<<span class="Apple-converted-space"> </span><br> </span></tt></span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: arial,sans-serif; font-size: 16px;"><span title="QOut('Bound rect ', aInfo[4]) ==> { 0, 1, 200, 24}" style="background-color: rgb(255, 255, 255);"><tt>QOut('Bound rect ', aInfo[4]) ==> {0, 1, 200, 24}</tt></span></span></span><br> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: arial,sans-serif; font-size: 16px;"><tt><span title="QOut('oXbpMenu:CurrentPos() ', ::currentPos()) ==> {1, -345}" style="background-color: rgb(255, 255, 255);"></span><span title="QOut('Item number ', aInfo[1]) ==> 18" style="background-color: rgb(255, 255, 255);">QOut('Item number ', aInfo[1]) ==> 18<span class="Apple-converted-space"> </span><br> </span><span title="QOut('Action ', aInfo[2]) ==> 1" style="background-color: rgb(255, 255, 255);">QOut('Action ', aInfo[2]) ==> 1<span class="Apple-converted-space"> </span><br> </span><span title="QOut('State ', aInfo[3]) ==> 256" style="background-color: rgb(255, 255, 255);">QOut('State ', aInfo[3]) ==> 256<span class="Apple-converted-space"> </span><br> </span></tt><span title="QOut('Bound rect ', aInfo[4]) ==> { 0, 1, 200, 24}" style="background-color: rgb(255, 255, 255);"><tt><span class="Apple-converted-space"></span></tt><br> </span><span title="É algum erro já conhecido, ou está correto?" style="background-color: rgb(255, 255, 255);">It is a bug already known, or I made some mistake?</span></span></span><br> <br> Beling<br> TIA<br> </blockquote> </body> </html> | |
AUGE_OHR | Re: Return error on XbpMenu():currentPos() - another issue on Wed, 12 Jan 2011 00:02:49 +0100 hi, > FUNCTION ApiGetXbpPosition_(oXbp) try this : get "relative" Window Position : FUNCTION PopAbsPos(oDlg) LOCAL aPos := {0,0} LOCAL aDlg := oDlg:currentpos() LOCAL aAbs := GetCursorPos() aPos[ 1 ] := aAbs[1] - aDlg[1] aPos[ 2 ] := aAbs[2] - aDlg[2] RETURN aPos FUNCTION GetCursorPos() LOCAL sPoint := REPLICATE(CHR(0),8) LOCAL nX := 0 LOCAL nY := 0 STATIC GetCursorPos IF GetCursorPos = NIL GetCursorPos := DllPrepareCall("user32.dll",DLL_STDCALL,; "GetCursorPos") ENDIF DllExecuteCall(GetCursorPos,@sPoint) nX := BIN2L(SUBSTR(sPoint,1,4)) BIN2L(LEFT(sPoint,4)) nY := BIN2L(SUBSTR(sPoint,5,4)) BIN2L(RIGHT(sPoint,4)) nY := (- 1 * nY)+APPDESKTOP():CURRENTSIZE()[2] - 1 Top-Down RETURN ({nX,nY}) greetings by OHR Jimmy | |
Carlos a Beling | Re: Return error on XbpMenu():currentPos() - another issue on Wed, 12 Jan 2011 16:01:49 -0200 Hello Jimmy: good afternoon: Many thanks again. I think that using this function I will get the cursor position, not the left corner of oXbpMenu(). Am I right? If I am, the cursor position will not enough for me. If I have the correct return of oXbpMenu:currenPos() every thing will work fine. Beling Best regards Em 11/1/2011 21:02, AUGE_OHR escreveu: > hi, > >> FUNCTION ApiGetXbpPosition_(oXbp) > try this : get "relative" Window Position : > > FUNCTION PopAbsPos(oDlg) > LOCAL aPos := {0,0} > LOCAL aDlg := oDlg:currentpos() > LOCAL aAbs := GetCursorPos() > > aPos[ 1 ] := aAbs[1] - aDlg[1] > aPos[ 2 ] := aAbs[2] - aDlg[2] > > RETURN aPos > > > FUNCTION GetCursorPos() > LOCAL sPoint := REPLICATE(CHR(0),8) > LOCAL nX := 0 > LOCAL nY := 0 > > STATIC GetCursorPos > > IF GetCursorPos = NIL > GetCursorPos := DllPrepareCall("user32.dll",DLL_STDCALL,; > "GetCursorPos") > ENDIF > > DllExecuteCall(GetCursorPos,@sPoint) > > nX := BIN2L(SUBSTR(sPoint,1,4)) > BIN2L(LEFT(sPoint,4)) > nY := BIN2L(SUBSTR(sPoint,5,4)) > BIN2L(RIGHT(sPoint,4)) > > nY := (- 1 * nY)+APPDESKTOP():CURRENTSIZE()[2] - 1 Top-Down > > RETURN ({nX,nY}) > > greetings by OHR > Jimmy > > | |
Andreas Gehrs-Pahl | Re: Return error on XbpMenu():currentPos() - another issue on Thu, 13 Jan 2011 05:42:02 -0500 Carlos, If you use oXbpMenu:DrawItem() in Owner-Drawn mode, then you will get the position and size in the "aInfo" parameter, so you don't need to use the (apparently not working) oXbpMenu:CurrentPos() method. Just store those values in some dedicated iVars of your sub-classed XbpMenu() object and use them instead. Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas.GP@Charter.net Andreas_Gehrs-Pahl@EJusticeSolutions.com Andreas@DDPSoftware.com web: http://www.Aerospace-History.net | |
Carlos a Beling | Re: Return error on XbpMenu():currentPos() - another issue on Thu, 13 Jan 2011 11:23:10 -0200 Hello Andreas: good morning. Many thanks. I think that I found out what oXbpMenu():currentPos() returns: aPos[01] has the nLeftBottomX of oXbpMenu() in relation to 0 of "drawingArea" of XbpCrt() aPos[02] if negative nLeftBottomY starts below the "drawingArea" of XbpCrt. if Abs(aPos[02] is greater than the real position of the "drawingArea" of Xbpcrt(), the negative value is relative to the top position of the "drawingArea". Hard to discover. Can it be confirmed? Beling Best regards Em 13/1/2011 08:42, Andreas Gehrs-Pahl escreveu: > Carlos, > > If you use oXbpMenu:DrawItem() in Owner-Drawn mode, then you will get the > position and size in the "aInfo" parameter, so you don't need to use the > (apparently not working) oXbpMenu:CurrentPos() method. Just store those > values in some dedicated iVars of your sub-classed XbpMenu() object and > use them instead. > > Andreas |