Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form keypress Conundrum
Message
De
12/01/2006 09:47:52
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01085658
Message ID:
01086047
Vues:
40
This message has been marked as a message which has helped to the initial question of the thread.
>>>Updated form keypress event (for future and lurkers):
>>>
>>>   DO CASE
>>>      CASE nKeyCode = 18 .AND. nShiftAltCtrl = 0  && Page Up
>>>         *--TCH 01/11/2006 Issue#3841 Courtesy Gregory Adam UT Thread 1085658
>>>         NODEFAULT
>>>         IF VARTYPE(THISFORM.ACTIVECONTROL) = "O" .AND. !ISNULL(THISFORM.ACTIVECONTROL) .AND. ;
>>>               PEMSTATUS(THISFORM.ACTIVECONTROL, 'SetFocus', 5)
>>>            THISFORM.ACTIVECONTROL.SETFOCUS()
>>>         ENDIF
>>>*--Etc
>>>
>>
>>Think you can shorten this a bit since vartype returns 'X' for null
>>
>>if( (vartype(m.thisform.ActiveControl) = 'O') and  PEMSTATUS(m.thisform.ActiveControl, 'SetFocus', 5) )
>>...
>>endif
>>
>
>I believe vartype(thisform.ActiveControl) will bomb out.

And I believe you're right. If no control on the form has the focus, then KA-BOOM

I have a form method that returns the active control (null if there is none).

Hence, I always use
local ac
ac = thisform.GetActiveControl()  && which uses type()
So, Tracy should use
local ac

ac = iif(type('m.thisform.ActiceControl') = T_OBJECT, m.thisform.ActiceControl, null)
=iif(!isnull(m.ac) and PEMSTATUS(m.ac, 'SetFocus', 5), m.ac.SetFocus(), .f.)
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform