Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MouseLeave() method on listbox doesn't always run.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00775793
Message ID:
00775995
Vues:
17
Hi Victor,

I've had better luck placing the listbox ontop of a shape that sits on the form just inside the form's boundaries. For some reason moving the mouse off of the listbox and passing over the shape causes the mouseleave event of the listbox to fire regardless of the mouse speed.

I should note that I am doing this in VFP8 so I have not tried it in VFP6 or VFP7.

Here's a small example that seems to work for me:
loform=CREATEOBJECT('mouseleaveexample')
loform.show
READ EVENTS
loform=.null.
RELEASE loform


DEFINE CLASS mouseleaveexample AS form

	Top = 0
	Left = 4
	Height = 250
	Width = 391
	DoCreate = .T.
	Caption = "MouseLeave Example"
	Name = "MyForm"

	ADD OBJECT shape1 AS shape WITH ;
		Top = -2, ;
		Left = -3, ;
		Height = 264, ;
		Width = 399, ;
		Name = "Shape1"


	ADD OBJECT list1 AS listbox WITH ;
		RowSourceType = 5, ;
		RowSource = "myarray", ;
		Height = 235, ;
		Left = 10, ;
		Top = 6, ;
		Width = 372, ;
		Name = "List1"


	PROCEDURE Load
		DIMENSION myarray(50)
		ln=0
		FOR i = 1 TO 50
		   ln=ln+1
		   myarray(ln)=ALLTRIM(STR(ln))
		ENDFOR
		DODEFAULT()
	ENDPROC
	
	PROCEDURE UnLoad
		CLEAR EVENTS
		DODEFAULT()
	ENDPROC

	PROCEDURE list1.MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		WAIT WINDOW "Left form at "+ALLTRIM(STR(SECONDS()));
                  NOCLEAR NOWAIT TIMEOUT 3
	ENDPROC


ENDDEFINE
>I have a listbox that covers an entire form. (Don't ask - there is a good reason)
>
>Anyway my problem is that when the person moves the mouse off the listbox (and thus the form) I want some code to run....sooooo I put it in the MouseLeave() method of the listbox. My problem is that unless the user is moving the mouse reeeeeeallly reaaaaaaly slow - the event doesnt run.
>Any suggestions on a fix for this??
>
>Thanks!
.·*´¨)
.·`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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform