Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>readh() - get user input right to left for hebrew data</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     readh() - get user input right to left for Hebrew data
  Usage:    <lastkey> = readh(<r1>,<c1>,<var>,[<attr>])
  Params:   integer <r1> - row where to place read
            integer <c1> - column where to start read (right end)
            string <var> - the memvar to fill, must be character type
            integer <attr> - color for the read buffer (optional),
            if left off then Clipper's foreground color is used

  Returns:  Optionally the lastkey pressed before exiting the readh().
            You can also check the lastkey() value since readh() sets it.

            Readh() emulates a Clipper GET command. By passing a
            memory variable, you can have the user fill in the memory
            variable directly with readh(). Since readh() is not tied
            to Clipper's GET system, you can do a readh() inside a
            function called by a SET KEY even if your are in a GET at
            the time. With careful control of looping using if/endif,
            you can create entire pages of readh(). Readh() can only
            fill a character type memory variable. Sending readh() any
            other type of memory variable to fill will result in
            unpredictable results. Note that the column number is the
            starting column going right to left. Since the readh() works
            right to left, you specify the starting column as if the
            end of the memvar were the beginning.

            A Hebrew font is supplied called FLhebrew(), load it into
            the appropriate table if you are using an EGA or VGA
            monitor. If you have a CGA or MDA, then all you will
            see are some upper ascii characters going right to left.
            The Hercules monochrome graphics adaptor can be modified
            with a special rom chip that contains the Hebrew character
            set. Readh() is compatible with this rom chip. The layout
            of the Hebrew characters on the keyboard are the same as
            is defined in the IBM National Supplement for Israel.
            The following example is a simple demonstration:

 ---------------------------------- Example ---------------------------------

                 if (vidtype() > 1)
                      FLhebrew()     && load the hebrew font
                 endif

                 set color to W/G
                 cls()

                 fname = space(15)
                 lname = space(20)

                 esc    = 0
                 level  = 1
                 c_rev  = 23
                 c_norm = 33

                 print(8,0,"First name....",c_norm)
                 print(9,0,"Last name.....",c_norm)

                 print(8,15,fname,c_norm)
                 print(9,15,lname,c_norm)

                 do whil .t.

                      do case
                      case level = 1
                           readh(8,29,fname,c_rev)
                           print(8,15,fname,c_norm)

                           if lastkey() = 29
                                level = 1
                                loop
                           endif
                           if lastkey() = 23
                                exit
                           endif
                           if lastkey() = 27
                                exit
                           endif
                           if lastkey() = 5
                                level = 2
                                loop
                           endif
                           level = 2

                      case level = 2
                           esc = readh(9,34,lname,c_rev)
                           print(9,15,lname,c_norm)

                           if esc = 5
                                level = 2
                                loop
                           endif
                           if esc = 29
                                level = 1
                                loop
                           endif
                           if esc = 23 .or. esc = 13
                                exit
                           endif
                           if esc = 27
                                exit
                           endif
                           if esc = 24
                                level = 1
                           loop
                           level = 2

                      otherwise
                           level = 1
                           loop

                 endcase
            enddo

  Keystrokes:    The following keys are normally active inside readh():

            HOME      - Goto beginning of field
            END       - Goto end of line/field
            BACKSPACE - Delete character to the right of cursor
            DELETE    - Delete character under the cursor
            INSERT    - Insert characters at current location
            CTRL/Y    - Erase all characters starting at current
                         cursor location to the end of the field
            CTRL/U    - Undo any editing, restores field.
            ESC       - Exit the readh, restore memvar

  Note:     Readh() is a wait state so you can use set key to and
            help routines. You must not however call readh() a
            second time if you hot key out to a second routine. You
            must also not alter the memory variable that you are
            reading in your hot key procedure. If you do, then
            the original contents of the memory variable are lost
            and the memory variable will not contain the users input.
            In addition to reading user input into a memory variable
            you can also have readh() fill an array element with user
            input. Just specify the array element you want to read into
            in place of the memory variable. On return, that array
            element will be filled with the users input. See the file
            hebtest.prg on the example diskette for an example on how to
            use the readh() function.


See Also: reverse() reads()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson