Se puede saber al perder el foco un textbox (lostfocus) si ha sido por pulsar la tecla Escape?
gracias
Un saludo
Se me olvidaba
Moderator: Rathinagiri
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Re: Se me olvidaba
Si, puedes hacerlo. Tengo dos formas para indicarte:
1. Es crear un evento y verificar si la tecla ES fué presionada.
2. Hacer disparar una funcion al presionar ESC.
1. Es crear un evento y verificar si la tecla ES fué presionada.
2. Hacer disparar una funcion al presionar ESC.
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 640 HEIGHT 480 ;
TITLE 'HMG Demo' ;
MAIN
ON KEY ESCAPE ACTION SeeWhatHappen(.T.)
@ 10,10 TEXTBOX Text_1 ;
VALUE 123 ;
TOOLTIP 'Numeric TextBox (MAXLENGTH 5)' ;
NUMERIC ;
MAXLENGTH 5 ;
RIGHTALIGN ;
ON LOSTFOCUS SeeWhatHappen(.F.) // if ( This.Value < 100 , This.SetFocus , Nil)
@ 40,10 TEXTBOX Text_2 ;
VALUE 'Hi All' ;
TOOLTIP 'Character TextBox' ;
DISABLEDBACKCOLOR { 0,255,0 } ;
DISABLEDFONTCOLOR { 255,255,255 }
END WINDOW
Form_1.Center
Form_1.Activate
Return Nil
Function SeeWhatHappen(lPressed)
If lPressed
MsgInfo("ESC was pressed !")
Endif
Return Nil
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein