Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LoadCursor Help
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00798912
Message ID:
00799619
Vues:
30
Hi Tracy,

Check the following code. Start typing in the EditBox on the form -- ShowCaret is linked to the InteractiveChange event. Otherwise I could not make it visible.
LOCAL obj
obj = CreateObject('Tform')
obj.Show(1)
* end of main

DEFINE CLASS Tform As Form
	Width=500
	Height=350
	BorderStyle=2
	MaxButton=.F.
	MinButton=.F.
	Autocenter=.T.
	Caption='Using Carets'
	hWindow=0
	hCaret=0
	hBitmap=0
	
	ADD OBJECT txt As EditBox WITH;
	Left=5, Top=5, Width=490, Height=300
	
PROCEDURE Init
	THIS.decl
	THIS.hBitmap = LoadBitmap(0, 32741)

PROCEDURE Activate
	IF THIS.hWindow = 0
		THIS.hWindow = GetFocus()
	ENDIF

PROCEDURE Destroy
	THIS.CaretOff

PROCEDURE Deactivate
	THIS.CaretOff

PROCEDURE txt.GotFocus
	ThisForm.CaretOn

PROCEDURE txt.InteractiveChange
	ThisForm.CaretOn
	= ShowCaret(ThisForm.hWindow)

PROCEDURE CaretOn
	THIS.CaretOff
*	THIS.hCaret = CreateCaret(THIS.hWindow, 0, 6,14)  && black
	THIS.hCaret = CreateCaret(THIS.hWindow, 1, 6,14)  && gray
*	THIS.hCaret = CreateCaret(THIS.hWindow, THIS.hBitmap, 6,14)  && system bitmap

PROCEDURE CaretOff
	IF THIS.hCaret <> 0
		= DestroyCaret()
		THIS.hCaret = 0
	ENDIF

PROCEDURE decl
	DECLARE INTEGER GetFocus IN user32
	DECLARE INTEGER DestroyCaret IN user32
	DECLARE INTEGER ShowCaret IN user32 INTEGER hWnd

	DECLARE INTEGER LoadBitmap IN user32;
		INTEGER hInstance, INTEGER lpBitmapName

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

ENDDEFINE
It works somehow, but still looks lousy. As I expected the FoxPro itself resets the caret to a default value constantly.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform