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 07:27:10
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/10/2001 15:28:05
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00575285
Message ID:
00576055
Views:
38
This message has been marked as the solution to the initial question of the thread.
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform