Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do VFP controls fake it?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01037136
Message ID:
01037593
Views:
17
You're right: no window handle means no caret can be attached to FoxPro TextBox control.

Technically, caret can be displayed at a given position on a FoxPro form. Linking caret to a TextBox would most likely require substantial amount of manual coding:
LOCAL oForm
oForm = CREATEOBJECT("TForm")
oForm.Show(1)
* end of main

DEFINE CLASS TForm As Form
	Width=500
	Height=300
	Autocenter=.T.
	Caption="Carets"

	ADD OBJECT cmd As CommandButton WITH;
	LEFT=10, Top=10, Width=80, Height=27

PROCEDURE Init
	THIS.declare

PROCEDURE Destroy
	= DestroyCaret()

PROCEDURE cmd.Click
	ThisForm.Test

PROCEDURE Test
	= DestroyCaret()
	= CreateCaret(THIS.HWnd, 0, 30,4)
	= SetCaretPos(50,100)
	= ShowCaret(THIS.HWnd)

PROTECTED PROCEDURE declare
	DECLARE INTEGER GetLastError IN kernel32
	DECLARE INTEGER ShowCaret IN user32 INTEGER hWnd
	DECLARE INTEGER HideCaret IN user32 INTEGER hWnd
	DECLARE INTEGER DestroyCaret IN user32
	DECLARE INTEGER GetCaretPos IN user32 STRING @lpPoint
	DECLARE INTEGER SetCaretPos IN user32 INTEGER X, INTEGER Y

	DECLARE INTEGER CreateCaret IN user32;
		INTEGER hWnd, INTEGER hBitmap,;
		INTEGER nWidth, INTEGER nHeight

ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform