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:
00799731
Vues:
21
Hi Anatoliy,

Thanks for checking into this. What is strange is that I added the showcaret call to the gotfocus to no avail. The only way to change the caret size and shape in the gotfocus is to also add a keyboard '{spacebar}' or some other valid editing keystroke which is not feasible for obvious reasons. Sending a keyboard '{HOME}' or any other key other than a valid editing key doesn't seem to change the caret size and shape.

Interesting... It also does not seem to work unless it is in a form. I can't seem to get it to work at all with _screen which is my goal. I guess this is not a capability that is truly available in VFP? Perhaps it should be added to the wishlist?

>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.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform