Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
_CUROBJ to ActiveControl
Message
De
06/01/1998 15:18:18
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
06/01/1998 15:07:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00069672
Message ID:
00069877
Vues:
55
>>>>>I use the up & downarrow keys to toggle through records. With FPW I could use the
>>>>>_CUROBJ=OBJNUM(FieldName) to return the cursor to the current field. I know with
>>>>>VFP5 I should use the ActiveControl property but I'm not sure how it's used. I'm
>>>>>inserting the code in the keypress method.
>>>>>
>>>>>TIA
>>>>>
>>>>>Chris
>>>>
>>>>If you gonna do something with other objects and then return to curobj set a form property to hold the reference - say oCurObject :
>>>>
>>>>*
>>>>* Keypress event
>>>>thisform.oCurObject = this && Save the reference
>>>>...
>>>>thisform.oCurObject.setfocus()
>>>
>>>I have 3 text boxes on the form (Text1, Text2, Text3)
>>>
>>>I tried this in the keypress event for Text2
>>>
>>>IF nKeyCode=24
>>> SKIP 1
>>> IF EOF()
>>> GO BOTTOM
>>> ENDIF
>>> This.Text2.SetFocus
>>>ENDIF
>>>
>>>It jumps to the next field (Text3 - tabindex 3) but
>>>if I use this in keypress event
>>>
>>>IF nKeyCode=24
>>> SKIP 1
>>> IF EOF()
>>> GO BOTTOM
>>> ENDIF
>>> This.Text1.SetFocus
>>>ENDIF
>>>
>>>It returns the cursor to Text2. Is there a way I could say return cursor
>>>to TabIndex-1 or am I just missing something?
>>nKeyCode= 24 DnArrow ? Well doesn't matter.
>>Just add a "nodefault" after if ..
>
>I'm not sure if I follow you on this one. nKeyCode is a keypress parameter and
>24 is INKEY() value for the DnArrow. I'm using a CASE statement because I check
>for other keypress values but for simplicity I used an IF example.
>
>So for the above code I would press the DnArrow key, display the next value and
>return to the Text2 object.
what is special with it is when you press dnarrow and call setfocus, focus is set to text2 and than normal (default) behaviour of DnArrow is executed. You should somewhat absorb it (nodefault) if you don't want it to happen. It is like with no keypress you are in text2 pressing dnarrow.
In "do case" also you should use "nodefault" after "case" statement if you don't want the default behaviour of key.
*keypress
do case
   case nKeycode = 28 && F1
        ..
        thisform.oObject.setfocus      && Than default for F1 fires (help)
   case nKeyCode = 122 && "z"
        nodefault    && Char "z" absorbed
        thisform.oObject.setfocus      && W/o nodefault "z" would be written in oObject.value (if applicable)
...
endcase
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform