Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining row/col pixel position of text cursor in con
Message
From
01/11/2001 12:49:28
 
 
To
01/11/2001 12:45:01
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00575285
Message ID:
00576267
Views:
21
Malcolm...

Coolness! and Bravo Cetin! and, Interface coolness coming up next!

Now that we have Windows handles to objects in VFP 7 that makes it all possible! Have to keep that in mind!

Jay

>Cetin,
>
>W-O-W! I'll repeat that again ... W-O-W! Absolutely fantastic!!!
>
>THANK YOU VERY, VERY MUCH!!!
>
>Regards,
>Malcolm
>
>PS: Might be a very cool feature to add to your FoxyClasses? :)
>
>
>>>Is there a way to determine the row and column pixel position of the text cursor in an input control such as a text box, edit box, or combo box?
>>>
>>>We would like to be able to popup a small 'smart tag' like form in our edit boxes when we detect certain text patterns. Ideally we would like to popup this 'smart tag' like form relative to the position of the text cursor.
>>>
>>>Any help or insights appreciated!
>>>Malcolm
>>
>>Malcolm,
>>Sounds like this thread replicates your previous question.
>>I replicate too in case someoe searches:)
>>
>>*Form.load && DLL, lib declarations
>>declare short GetCaretPos in win32API string @ lpPoint
>>declare short ClientToScreen in win32Api integer hWnd, string @ lpPoint
>>declare SetCursorPos in win32API integer X, integer Y
>>set library to home()+'foxtools.fll' additive
>>
>>*Where you need the follower - keypress, interactivechange etc
>>Local lpPos, lnWHND, lnX,lnY,lnScreenX,lnScreenY
>>Store 0 to lnX,lnY,lnScreenX,lnScreenY
>>lpPos = space(8)
>>lnHWND =  _WhToHwnd(_WOnTop())
>>
>>GetCaretPos(@lpPos) && Get text insertion point coordinates - in terms of form
>>For ix=1 to 8   && Decode 2 long values (X and Y)
>>  If ix<5
>>    lnX = lnX + asc(substr(lpPos,ix))*256^(ix-1)
>>  Else
>>    lnY = lnY + asc(substr(lpPos,ix))*256^(ix-5)
>>  Endif
>>Endfor
>>ClientToScreen(lnHWND, @ lpPos) && Convert client coords to screen coords
>>For ix=1 to 8
>>  If ix<5
>>    lnScreenX = lnScreenX + asc(substr(lpPos,ix))*256^(ix-1)
>>  Else
>>    lnScreenY = lnScreenY + asc(substr(lpPos,ix))*256^(ix-5)
>>  Endif
>>Endfor
>>SetCursorPos(lnScreenX,lnScreenY) && Set mouse pos to coords
>>Set message to 'CurX:'+trans(lnX)+'   CurY:'+trans(lnY) && Line-Col in statbar
>>
Cetin
Previous
Reply
Map
View

Click here to load this message in the networking platform