if i set Keypreview=.T. ( i want this setting ),I will see 'This is second' and then 'This is first' .
and if i set Keypreview=.F. ,I will see ONLY 'This is first' .
am i right?
in fact i want this for one combo box in my form. i want to have ESC code for Exit from combo and from my form separately. i want if i am in combo, when i press ESC, only my combo closed and if i am in another control, i can exit from my form.
>Very good. In your example you will see 'This is first' and then 'This is second' if F12 pressed within the textbox. Do you want something different?
>
>>But i have some key definition in my form KeyPress event.
>>it is an example.
>>
>>
>>>Form.Keypreview=.T. allows to fire both form and control code.
>>>Form.Keypreview=.F. allows to fire control code only.
>>>
>>>
>>>>Dear all,
>>>>I have a form as below
>>>>
>>>>PUBLIC oform1
>>>>oform1=NEWOBJECT("form1")
>>>>oform1.Show
>>>>RETURN
>>>>
>>>>*
>>>>DEFINE CLASS form1 AS form
>>>>
>>>> Height = 144
>>>> Width = 283
>>>> DoCreate = .T.
>>>> Caption = "Form1"
>>>> KeyPreview = .T.
>>>> Name = "Form1"
>>>>
>>>>
>>>> ADD OBJECT text1 AS textbox WITH ;
>>>> Height = 23, ;
>>>> Left = 91, ;
>>>> Top = 60, ;
>>>> Width = 100, ;
>>>> Name = "Text1"
>>>>
>>>>
>>>> PROCEDURE KeyPress
>>>> LPARAMETERS nKeyCode, nShiftAltCtrl
>>>> IF nKeyCode = 134
>>>> WAIT WINDOW 'this is second' TIMEOUT 1
>>>> ENDIF
>>>> ENDPROC
>>>>
>>>>
>>>> PROCEDURE text1.KeyPress
>>>> LPARAMETERS nKeyCode, nShiftAltCtrl
>>>> IF nKeyCode = 134
>>>> WAIT WINDOW 'this is first' TIMEOUT 1
>>>> ENDIF
>>>> ENDPROC
>>>>
>>>>
>>>>ENDDEFINE
>>>>
>>>>
>>>>But i want to see 'this is first' so 'this is second' when i press F12.
>>>>Can i do this?
>>>>Thanks