General information
Category:
Forms & Form designer
Title:
Enter Key not registering as a KeyPress Event in ListBox
Hi there,
I am working on an application written in VFP 5.0, and am having the following issue:
I have the code below in the ParentForm.KeyPress procedure, yet when focus is on the list box ("LSTCOMP") and I hit the ENTER key, my application doesn't run code in the KeyPress procedure.
******************************************
LPARAMETERS nKeyCode, nShiftAltCtrl
local lcObject
if type('thisform.activecontrol')<>'U'
lcObject = THISFORM.ACTIVECONTROL.NAME
Do case
case upper(lcObject) = 'TXTITEM'
** if the user hits the enter key, move focus to next object
if nKeyCode = 13
keyboard '(TAB)'
endif
case upper(lcObject) = 'LSTCOMP'
do case
** if user hits Enter, "click the OK button"
case nKeyCode = 13
thisform.cmdOk.click()
nodefault
RETURN .F.
endcase
endcase
endif
******************************************
Why isn't the ENTER key seen as a keypress while focus is on the listbox?
Thanks for listening and for any ideas you might have,
Joe
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only