Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Keypress event not firing
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01011173
Message ID:
01011469
Vues:
19
Thanks for replying

I suspect this is a bug.

In my base form class I have the following code.
LPARAMETERS nKeyCode, nShiftAltCtrl

IF thisform.FunctionKeyPress(m.nKeyCode, m.nShiftAltCtrl)
	NODEFAULT
ENDIF
in my base form class FunctionKeyPress I have
LPARAMETERS nKeyCode, nShiftAltCtrl

LOCAL lNodefault as Boolean
m.lNodefault = .T.
WITH thisform
	DO CASE
	CASE nKeyCode = 21		&& F1
		.ShowHelp(.ActiveControl)
	CASE nKeyCode = -7		&& F8
		IF .ResolveConflicts(.T.)
			.Release()
		ENDIF	
	CASE nKeyCode = 27		&& ESC
		.Release()
	OTHERWISE
		m.lNodefault = .F.
	ENDCASE
ENDWITH
RETURN m.lNodefault
in my derived forms I overload FunctionKeyPress with similar code but generally
	DO CASE
	CASE ...
	CASE ...
	CASE DODEFAULT(m.nKeyCode, m.nShiftAltCtrl)	&& -- Standard Hot keys
	OTHERWISE
	ENDCASE
If I have KeyPreview = .F. in the base class but set it in my derived form the keypress event of my controls is not fired.

As soon as I set KeyPreview = .T. in the base form class, it works properly.

This is not a biggy as I should really have it set in my base form class anyway.

I'm not sure what they have done with the event handling in VFP9. I had to place all my controls in a container to make the initialisation event sequence work properly. You probably remember the bug I reported earlier.

Do you have any idea when a service pack will be available?

Regards
Geoff Scott



>No it's not normal. Most likely something in your code causes that.
>
>>It appears that I need to set the KeyPreview in the base class for it to fire properly. Is this normal?
>>
>>Regards
>>Geoff
>>>Hi
>>>
>>>Is anyone else having a problem with the keypress event of the control not firing when the form property KeyPreview = .T.
>>>
>>>My form keypress event calls a method on the form (FunctionKeyPress) which goes through its paces but when the keypress event finishes the control keypress does not fire.
>>>
>>>Any pointers as to what is going wrong?
>>>
>>>regards
>>>Geoff
May all your weeds be wildflowers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform