KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using the Up and Down arrow key with a scrollable area
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: January 3, 2003

Compatibility: Version 6.7.x and 6.8.x

This tech tip shows you how to give a user the ability to switch array elements within a scrollable area with the Up and Down arrow key. Try the following steps below to build yourself an example:

1. Create a scrollable area on a detail form. In this example, let's name it "arrText".



2. In the Property List, click Edit for the Value list to assign some test array elements to the scrollable area object.

3. Create a variable object on the form and assign the object and variable name to "hiddenVar".

4. From either the Object Properties or Property List, make sure that hiddenVar's object setting match the following:
- Transparent option is "On".
- Boarder Line Style is "None".
- Tabbable and Focusable options are "Off".
- On Load and On Before Keystroke events are "On".

5. Move the object "hiddenVar" to the bottom left corner of the form and Set the object size to 0x0 pixel.

6. Create the following object method to arrText.

` Object Method: arrText

If (Form event=On Clicked )

 GOTO AREA(*;"hiddenVar")

End if
7. Create the following object method to hiddenVar.
` Object Method: hiddenVar
Case of
 : (Form event=On Load )
  C_LONGINT(vlArrSize)
  vlArrSize:=Size of array(arrText)
 : (Form event=On Before Keystroke )
  Case of
   : (Ascii(Keystroke)=31)
    If ((arrText>=1) & (arrText<vlArrSize))
     arrText:=arrText+1
   End if
  : (Ascii(Keystroke)=30)
   If ((arrText>1) & (arrText<=vlArrSize))
    arrText:=arrText-1
   End if
  End case
  FILTER KEYSTROKE("")
End case