Ian Henderson
2003-11-24 12:11:16 UTC
Alert: Newbie question!!
Pg 38 of the programmers guide (under the heading smart windows dumb
controls), makes it clear that in VO, events are handled by windows.
I thought I understood correctly and this has seemed to be the case until I
tried a simple dialogwindow.
It's a simple dialogbox with one control, a listbox that fills the window,
and displays the contents of an array. If one of the elements of the array
is itself an array, I doubleclick on that and a new dialog appears showing
his elements etc.
All this works fine, but now I want to press the enter key on a selected
element and have the same effect as a double click, also I wane the Esc key
to close any open box.
I use the keydown method, and none of this works. My guess is the listbox
is trapping the keydown ( contrary to what the documentation about events
being handled by windows )!!!
Is that the case? If so, how could I make the enter key do the same as the
doubleclick?
Finally where is a good place to get a good understanding of handling the VO
events.
Here is a portion of the code that doesn't work as I hoped:
METHOD KeyDown(oKeyEvent) CLASS aDispDialog
LOCAL nKeyCode AS SHORT
SUPER:Keydown( oKeyEvent )
nKeyCode := IIf(oKeyEvent = NULL_OBJECT, 0,
IIf(IsNil(oKeyEvent:ASCIIChar), ;
oKeyEvent:KeyCode, oKeyEvent:ASCIIChar))
IF ( nKeyCode = KEYENTER )
SELF:DoSelection()
ELSEIF ( nKeyCode = KEYESCAPE )
SELF:EndDialog()
ENDIF
METHOD DoSelection CLASS aDispDialog
LOCAL nSel := SELF :ArrayShowListBox:CurrentItemNo
LOCAL aArray := SELF:aArrayActual
IF IsArray( aArray[nSel] )
adisplay( aArray[ nSel] , SELF ) // Recursive call to self
ENDIF
Pg 38 of the programmers guide (under the heading smart windows dumb
controls), makes it clear that in VO, events are handled by windows.
I thought I understood correctly and this has seemed to be the case until I
tried a simple dialogwindow.
It's a simple dialogbox with one control, a listbox that fills the window,
and displays the contents of an array. If one of the elements of the array
is itself an array, I doubleclick on that and a new dialog appears showing
his elements etc.
All this works fine, but now I want to press the enter key on a selected
element and have the same effect as a double click, also I wane the Esc key
to close any open box.
I use the keydown method, and none of this works. My guess is the listbox
is trapping the keydown ( contrary to what the documentation about events
being handled by windows )!!!
Is that the case? If so, how could I make the enter key do the same as the
doubleclick?
Finally where is a good place to get a good understanding of handling the VO
events.
Here is a portion of the code that doesn't work as I hoped:
METHOD KeyDown(oKeyEvent) CLASS aDispDialog
LOCAL nKeyCode AS SHORT
SUPER:Keydown( oKeyEvent )
nKeyCode := IIf(oKeyEvent = NULL_OBJECT, 0,
IIf(IsNil(oKeyEvent:ASCIIChar), ;
oKeyEvent:KeyCode, oKeyEvent:ASCIIChar))
IF ( nKeyCode = KEYENTER )
SELF:DoSelection()
ELSEIF ( nKeyCode = KEYESCAPE )
SELF:EndDialog()
ENDIF
METHOD DoSelection CLASS aDispDialog
LOCAL nSel := SELF :ArrayShowListBox:CurrentItemNo
LOCAL aArray := SELF:aArrayActual
IF IsArray( aArray[nSel] )
adisplay( aArray[ nSel] , SELF ) // Recursive call to self
ENDIF