Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

do not use UP DOWN arrows in combobox 1

Status
Not open for further replies.

georgehoaghea

Programmer
Dec 5, 2003
5
CA
Hi
I try to don't use arrows in combobox, except if dropdowned.
Looking to thread184-603260 it gave me a way. But it doesn't work properly.
KeyPress event:
IF This.mDrop =.F.
DO CASE
CASE nKeyCode == 24 &&down
IF This.ListIndex >= 1 and This.ListIndex < This.ListCount
This.ListIndex = This.ListIndex - 1
ENDIF
KEYBOARD '{TAB}'
CASE nKeyCode == 5 &&up
IF This.ListIndex > 1 and This.ListIndex <= This.ListCount
This.ListIndex = This.ListIndex + 1
ENDIF
KEYBOARD '{BACKTAB}'
ENDCASE
ELSE
IF nKeyCode == 13 &&enter
KEYBOARD '{TAB}'
ENDIF
ENDIF

DropDown:
This.mDrop = .T.

LosFocus:
This.mDrop = .F.

Problem occurs when last element in list and press UP (It skips to first element)
Any idea?
Thanks
 
Hi George.

Amend your code as follows:

Code:
LPARAMETERS nKeyCode, nShiftAltCtrl
IF This.lDroppedDown = .F.
  IF INLIST( nKeyCode, 5, 24 )
    NODEFAULT
    IF nKeyCode == 24  &&down
      KEYBOARD '{TAB}'
    ELSE
      IF nKeyCode == 5  &&up
        KEYBOARD '{BACKTAB}'
      ENDIF
    ENDIF
  ENDIF
ELSE
 IF nKeyCode == 13  &&enter
  KEYBOARD '{TAB}'
 ENDIF
ENDIF

But consider whether you really want an applications whose controls behave differently than any other drop down list in any other windows application.

Marcia G. Akins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top