Supporting Shift-Tab

Post Reply
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Supporting Shift-Tab

Post by xProgrammer »

Hi Antonio

I have managed to support Shift-Tab, although in a possibly round-about manner. I added the following case to the KeyDown() method of the TGet class.

Code: Select all

case nKey == 65056  // Shift-Tab
           ::lShiftTab := .T.
           IF ::bShiftTab != nil
              EVAL( ::bShiftTab )
           ENDIF
(obviously new DATAs lShiftTab and bShiftTab).

I made similar a modification for Tab. The controls were stored in array aCTL[]. There were two parallel arrays aPREV[] and aNEXT[] which stored the previous and next control via the corresponding index into aCTL[].

bShiftTab was set along the following lines:

{ | | ::aCTL\[(::aPREV\[<index>])]:SetFocus() }

I used a custom #translate to save on typing:

Code: Select all

#xtranslate _xget <index> VAR <variable> WIDTH <width> [PICTURE <picture>] => GET ::aCTL\[<index>] VAR <variable> OF dlgPATIENT SIZE <width>, 25 WHEN ::lEdit BLACK PIXEL [PICTURE <picture>];;
::aCTL\[<index>]:bShiftTab  := { | | ::aCTL\[(::aPREV\[<index>])]:SetFocus() } ;;
::aCTL\[<index>]:bTab := { | | ::aCTL\[(::aNEXT\[<index>])]:SetFocus() }
This means that a typical TGet object becomes:

Code: Select all

@  90, 110 _xget  2 VAR ::sNmGiven WIDTH 320
I would be happy to provide more information if anyone needs it.

Doug
(xProgrammer)
Post Reply