How
to reacts on pressing a key on the keyboard
The bBrowser contains an interface, with that keyboard commands
can be defined. A keyboard command consists of a key code and
a method, that is called when pressing the appropriate key.
The keyboard command works only if the bBrowser possess the
focus.
With the class bKeyCommand a keyboard command can be defined.
This can be added afterwards with the instruction bBrowser:KeyCommand:Add()
to the bBrowser.
The following code fragment defines for a bBrowser in a DataWindow
a keyboard command for the key F2. When pressing the F2 key
a cell edit is opened in the current cell.
|
METHOD
PostInit() CLASS myDataWindow
LOCAL oKeyCommand AS bKeyCommand
oKeyCommand := bKeyCommand{KeyF2,,,,, self,
#OnEdit}
self:oDCBrowser:KeyCommand:Add(oKeyCommand)
METHOD OnEdit() CLASS myDataWindow
self:oDCBrowser:Edit()
|
The following code fragment defines for a bBrowser in a DataWindow
a keyboard command for the key combination CTRL + DELETE. When
pushing this key combination the current record is deleted in
the bBrowser.
|
METHOD
PostInit() CLASS myDataWindow
LOCAL oKeyCommand AS bKeyCommand
oKeyCommand := bKeyCommand{KeyDelete,;
,;
True,;
,;
,;
self,;
#OnRecordDelete}
self:oDCBrowser:KeyCommand:Add(oKeyCommand)
METHOD OnRecordDelete() CLASS myDataWindow
self:oDCBrowser:Delete()
|
|