Subject |
RE: USE of ENTER KEY |
From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
Date |
Wed, 22 Feb 2017 10:44:45 -0500 |
Newsgroups |
dbase.getting-started |
Mustansir Ghor Wrote:
> Hello Everyone
>
> In a grid which event will be fired on pressing the "ENTER" key
>
> Regards
> Mustansir
I have trapped the enter key using the onkeylabel. Various steps involved are as follows
In the start of the form
parameter bModal
public m
m = new mainmenuForm()
m.mdi = false // ensure not MDI
m.readModal()
release m
return // to prevent execution of form twice
** END HEADER -- do not remove this line
//
// Generated on 22/02/2017
//
parameter bModal
local f
f = new mainmenuForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
In the Grid
with (this.GRID1)
onGotFocus = class::GRID1_ONGOTFOCUS
onLostFocus = class::GRID1_ONLOSTFOCUS
function GRID1_onGotFocus()
on key label enter mainmenuform::select_comp_onclick()
// to start the enter key trapping
// select_comp_onclick() is also fired when select_comp push button is clicked
// it can be any code you refer to
return
function GRID1_onLostFocus()
on key label enter
// to stop the enter key trapping when grid looses focus.
return
This way you can execute any function you want to execute.
If you are opening another form then please take care to check if GRID1_onLostFocus() has executed or not.
A very old fashioned trick.
Regards
Akshat
|
|