Hi,
I have a form on an VFP 9.0-based application that needs to allow for fast data-entry. Users will use the mouse sporadically since almost all of the interactive activity will be keyboard-based.
I am having problems handling certain keyboard combinations.
I am not using any ON KEY LABEL assignments and there are no declared/active keyshortcuts in the (FILE) main menu.
The form's KeyPreview property is set to .T. and the KeyPress method contains this code:
The CMD_New and Cmd_Save object's Click() events fire properly.
(a) However, the TextBox where the cursor was at the time of the key shortcut (CTRL+N) call also reflects the CTRL+N combination in the form of ASCII character 14 ( '' ). How do I suppress that '' input/output? I tried issuing CLEAR TYPEAHEAD on different locations but didn't succeed.
(b) After the CMD_Save.Click() event has fired, the CTRL+S key behaves becomes like a LEFT-ARROW in that it moves the cursor/focus to the preceeding TextBox (the LEFT-ARROW key also equals KeyCode 19 as per the INKEY() documentation). How do I prevent the cursor from moving to the preceeding TextBox Object and only execute the CMD_Save.Click() method?
I imagine the answer to both 'behavior problems' is the same, but after 2 1/2 hours invested in futile attempts I look forward to your collective wisdom!!!
Many many thanks,
Kenneth Tamayo
San Juan, Puerto Rico - USA
I have a form on an VFP 9.0-based application that needs to allow for fast data-entry. Users will use the mouse sporadically since almost all of the interactive activity will be keyboard-based.
I am having problems handling certain keyboard combinations.
I am not using any ON KEY LABEL assignments and there are no declared/active keyshortcuts in the (FILE) main menu.
The form's KeyPreview property is set to .T. and the KeyPress method contains this code:
Code:
LPARAMETERS nKeyCode, nShiftAltCtrl
DO CASE
CASE nKeyCode= 14 && Key=CTRL+N
IF THISFORM.IsEditing = 0 .AND. THISFORM.Cmd_New.Enabled = .T.
THISFORM.Cmd_New.Click()
ENDIF
CASE nKeyCode= 19 && Key=CTRL+S
IF THISFORM.IsEditing <> 0 .AND. THISFORM.Cmd_Save.Enabled = .T.
THISFORM.Cmd_Save.Click()
ENDIF
ENDCASE
The CMD_New and Cmd_Save object's Click() events fire properly.
(a) However, the TextBox where the cursor was at the time of the key shortcut (CTRL+N) call also reflects the CTRL+N combination in the form of ASCII character 14 ( '' ). How do I suppress that '' input/output? I tried issuing CLEAR TYPEAHEAD on different locations but didn't succeed.
(b) After the CMD_Save.Click() event has fired, the CTRL+S key behaves becomes like a LEFT-ARROW in that it moves the cursor/focus to the preceeding TextBox (the LEFT-ARROW key also equals KeyCode 19 as per the INKEY() documentation). How do I prevent the cursor from moving to the preceeding TextBox Object and only execute the CMD_Save.Click() method?
I imagine the answer to both 'behavior problems' is the same, but after 2 1/2 hours invested in futile attempts I look forward to your collective wisdom!!!
Many many thanks,
Kenneth Tamayo
San Juan, Puerto Rico - USA