Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Esc from textbox or editbox - loosing characters
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00131731
Message ID:
00131733
Vues:
29
>On a form I have the keypress event look for the Esc key and then release the form - this is fine unless the user was editing a text or edit box - then any chnges to the field are lost.
>
>Can you force a TAB character before the form.release?
>
>thanks in advance.

Richard, in general you need the to call custom Form.Writebuffer() method from Form.QueryUnload() event, which will take care of that.
Here is tsBaseForm.Writebuffer() from Tasmanian Traders VFP sample.
***********tsBaseForm.Writebuffer()
LOCAL llRetval
llRetVal = .T.

*-- Code to save field value to buffer when
*-- clicking on toolbar without leaving the field
*-- Don't do this for a grid since a grid may change
*-- work areas unexpectedly
IF TYPE("thisform.ActiveControl") == "O" AND ;
    UPPER(thisform.ActiveControl.BaseClass) <> "GRID"
  IF TYPE("thisform.ActiveControl.ControlSource") <> "U" AND ;
      !EMPTY(thisform.ActiveControl.ControlSource)
    IF EVAL(thisform.ActiveControl.ControlSource) <> thisform.ActiveControl.Value
      REPLACE (thisform.ActiveControl.ControlSource) WITH thisform.ActiveControl.Value
      *-- We rely on the fact that we revert the field's value
      *-- in the error event method for the form. 
      llRetVal = (EVAL(thisform.ActiveControl.ControlSource) = thisform.ActiveControl.Value)
    ENDIF
  ENDIF
ENDIF

RETURN llRetVal
You can search there also, which form custom methods call WriteBuffer()
All commercial frameworks have similar kinds of Form.WriteBuffer() method in their base form classes.

HTH,

Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform