Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows API functions for edit box controls
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00575476
Message ID:
00575581
Vues:
23
>Is there a Windows API function that will return the ABSOLUTE row and column position (in pixels) of the text cursor within an edit box?
>
>Is there a Windows API function that will return the row and column position (in pixels) of the text cursor within an edit box RELATIVE to the frame of the edit control?
>
>Thanks!
Malcolm,

Ed's given you the basics, but here are some hints.

First, foxtools has a function (_GetWRect()) that'll return the absolute position of the form of the form. You need to supply it with the form's window handle:
* Assumes Foxtools is loaded
IF "7.0" $ VERSION()
  lnhwnd = ThisForm.hWnd
ELSE
  lnhwnd = _WhTohWnd(_WFindTitl(ThisForm.Caption))
ENDIF
STORE 0 TO nTop, nLeft, nBottom, nRight
= _GetWRect(lnHwnd, @nTop, @nLeft, @nBottom, @nRight)
Second, use the OBJTOCLIENT() to retrive the top and left position of the object relative to the client area.

Third, adjust for the frame width, height and the height of the title bar using the SYSMETRIC() function.

I do something similar in my Obj2Bmp applicaton which is available for download. A couple of notes, however. First, in order to reduce the need for Foxtools, I used the GetWindowRect() API call and resolve the POINT structure that Ed mentioned. Second, since I didn't know whether or not OBJTOCLIENT() existed in 5.0 (and was too stupid to look in the "What's New" section), I resolve the location using a different method.

This should get you started should you choose to rely on a native VFP control.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform