⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcxl.doc

📁 就一个字强.很不错,希望大家能喜欢.这是我朋友发给我的
💻 DOC
📖 第 1 页 / 共 5 页
字号:


































                                      7    


Using TCXL's inputsf() and winputsf() Functions.


    The inputsf() and winputsf() functions in TCXL accept keyboard input
through the use of TCXL's own input format strings.  These format strings are
not the same as what scanf() uses.  They have the ability to restrict and
convert input for each character received from the keyboard.  They also allow
for custom prompts between each character input.  The format control characters
can be in any order in the string, but all letters must be in the case shown
here.  Invalid control characters will cause the function to return an error
and the receiving string will be null. Spaces can be used to improve
readability of the format string.  If the Escape key is not disabled, when
pressed it will return an error code and the receiving string will be null.
Valid control characters are:

            !.......!   - start and end exclamation points, any letters
                          between them are format command toggles.  The
                          valid format command toggles are:

                            -   - decreases text attribute, works with
                                  winputsf() only

                            +   - increases text attribute, works with
                                  winputsf() only

                            C   - toggles copying of display (quoted)
                                  characters to the receiving string.
                                  (default is off)

                            E   - toggles Escape key checking off/on.
                                  When off, if the Escape key is pressed,
                                  the function returns an error code and
                                  the string will be null.   The default
                                  for inputsf() is on.  For winputsf(),
                                  the default is the value of _wesc upon
                                  calling.

                            L   - toggles lower-case conversion.  When on,
                                  the case of input letters will be forced
                                  to lower case.  (default is off)

                            M   - toggles mixed-case conversion.  When on,
                                  the case of input letters will be forced
                                  to upper-case for the first letter of
                                  each word and lower-case for the
                                  remaining letters.  (default is off)

                            R   - toggles return key checking.  When off,
                                  the carriage return key will be ignored
                                  until the end of the format string.
                                  (default is on)

                            U   - toggles upper-case conversion.  When on,
                                  the case of input letters will be forced
                                  to upper-case.  (default is off)


                                      8    


            '.......'   - start and end single quotes, any characters
                          between them will be displayed as text.  If the 'C'
                          command toggle is on, the characters will also be
                          copied to the receiving string.

            Character type codes:

            #   - accept numeric character '0' thru '9'
            9   - accept numeric character '0' thru '9', '.', '-', and '+'
            ?   - accept any character
            A   - accept alpha character 'A' thru 'Z', 'a' thru 'z', and space
            L   - accept alpha character 'A' thru 'Z', 'a' thru 'z', and space
                  input character will be converted to lower case
            M   - accept alpha character 'A' thru 'Z', 'a' thru 'z', and space
                  input character will be converted to mixed case
            P   - accept printable character (ASCII 20 thru 7E)
            U   - accept alpha character 'A' thru 'Z', 'a' thru 'z', and space
                  input character will be converted to upper case
            X   - accept alphanumeric character 'A' thru 'Z', 'a' thru 'z',
                  '0' thru '9', and space
            Y   - accept a yes/no character 'Y', 'y', 'N', and 'n'


            <.......>   - start and end angle brackets, accept a character
                          from valid list of characters between angle brackets.

    Examples:

        inputsf(str,"'Enter name:  ' !UR! XXXXX !R! XXXXXXXXXX");

            Prompts for name, inputs string from keyboard converting characters
            to upper case as it goes, allows up to 15 alphanumeric characters
            as input.  The return key is disabled until at least 5 characters
            have been entered.  Characters will be copied to str.  This space
            must already be allocated!


        inputsf(str,"!R! 'Enter phone:  '!C! '(' ### ') ' ### '-' ####");

            Prompts for a full phone number including area code, allows only
            digit characters and displays format punctuation as it goes.  The
            entire field must be filled before return can be pressed.  All of
            the characters except the prompt will be copied to the receiving
            string.  The input string will be copied to str, which must have
            already been allocated.


        inputsf(str,"!R!'Enter SSAN:  '<0123456>##'-'##'-'####");

            Prompts for a Social Security number.  Will not allow return to be
            pressed until all digits have been entered.  The first digit of the
            SSAN must be 0 - 6. Dashes will be displayed as you are typing in
            the data, but will not be contained in the receiving string str.




                                      9    
        inputsf(str,"!R!'Enter DOB (MM/DD/YY):  '<01>#'/'<0123>#'/'##");

            Prompts for Date of Birth.  Allows only valid digits for the input
            date.  Prevents the return key from working until all digits have
            been typed in.






















































                                      10   


Using TCXL's Multi-Field Window Input Functions.


    Two functions are needed to process multi-field keyboard input from
windows:  winpdef(), and winpread().  The winpdef() function sets up an input
field.  For every input field you want defined, you must call winpdef().  It
displays the current contents of what is to be the receiving string. The size
of the string before winpdef() is called will be the size of the input field.
You may need to resize the string before calling winpdef().  You can do this
with the strsetsz() function.  The winpdef() function will also specify the
type of the field.  Valid field types are:

        #   - allow only numeric characters '0' thru '9'
        9   - allow only numeric characters '0' thru '9', '.', '-', and '+'
        ?   - allow any characters
        A   - allow only alpha characters 'A' thru 'Z', 'a' thru 'z', and space
        L   - allow only alpha characters 'A' thru 'Z', 'a' thru 'z', and space
              input characters will be converted to lower case
        M   - allow only alpha characters 'A' thru 'Z', 'a' thru 'z', and space
              input characters will be converted to mixed case
        P   - allow only printable characters (ASCII 20 thru 7E)
        U   - allow only alpha characters 'A' thru 'Z', 'a' thru 'z', and space
              input characters will be converted to upper case
        X   - allow only alphanumeric characters 'A' thru 'Z', 'a' thru 'z',
              '0' thru '9', and space
        Y   - allow only yes/no characters 'Y', 'y', 'N', and 'n'

    The case of the field type characters must be as shown.  For every input
field you want defined, you must call winpdef().

    The winpread() function processes all fields defined with winpdef().  The
user is allowed to move around and edit all of the fields.  Valid editing keys
are:

        LeftArrow   - moves cursor left inside the field
        RightArrow  - moves cursor right inside the field
        UpArrow     - moves cursor to the previous field up
        DownArrow   - moves cursor to the next field down
        Tab         - moves cursor to the next field right
        Shift-Tab   - moves cursor to the next field left
        Enter       - if the cursor is in the last field on the screen, it will
                      process all fields.  Otherwise it will skip to the next
                      field
        Ctrl-Enter  - processes all fields, wherever the cursor may be
        Home        - moves cursor to beginning of field
        End         - moves cursor to end of field
        Ctrl-Home   - moves cursor to the beginning of the first field on the
                      screen
        Ctrl-End    - moves cursor to the end of the last field on the screen
        Ins         - inserts a space at cursor location.  All text to the
                      right of the cursor will be shifted right.  The end
                      character will be dropped.
        Del         - deletes character at the cursor location.  All text to
                      the right of the cursor will be shifted left and a space
                      will be inserted at the end of the field.


                                      11   
        Esc         - if enabled, cancels input and returns a W_ESCPRESS value.
                      Escape checking can be enabled or disabled by using the
                      wsetesc() function before winpread() is called.

    After the winpread() function is called, all fields defined with winpdef()
will be cleared.  The receiving strings of all defined fields will now contain
the data entered.  If Escape checking was on and the Esc key was pressed, then
all receiving strings will contain the values they held before winpread() was
called.

    Another function that can be used in multi-field keyboard input is the
winpxcel() function.  What this does is cancel all fields defined with
winpdef().  For winpxcel() to have any effect, it must be called before
winpread() is.













































                                      12   


Using TCXL's Window Bar-Selection Menus.


    Two functions are needed to use TCXL's bar-selection menus:  wmbardef(),
and wmbarget().  The wmbardef() function displays the menu option on the
screen and assigns a tag character to it.  The tag character is used for
identification of the menu option.  The tag character must be alphanumeric and
is case insensitive.  For every menu option you have, the wmbardef() function
must be called.

    When all menu options have been defined, you will call the wmbarget()
function.  The first argument to wmbarget() is the attribute of the selection
bar.  The second argument is the tag character of where you want the selection
bar to initially be located.  If an undefined tag character is used, then the
initial position of the selection bar will default to the upper-leftmost
option.  The third argument of wmbarget() is the pulldown parameter.  This is
used for a pull-down menu system.  If a pull-down menu system is not being
used, then the pulldown parameter should be specified as zero.

    If you are using pull-down menus, then the pulldown parameter may have
one of four values.  PDMAIN is used to signify that the menu you have just
defined is to be the main menu of a pull-down menu system.  PDMENU is used to
signify that the menu you have just defined is one of the pull-down menus from
the main menu.  The other two values that the pulldown parameter can have are
used for movement between pull-down menus.  PDPREV is used to signify that the
menu you have just defined is the main menu and you wish to automatically
select the option previous to the specified taginit.  PDNEXT is used to signify
that the menu you have just defined is the main menu and you wish to
automatically select the next option after the specified taginit.

    Movement/selection keys that are used during the wmbarget() function are:

        LeftArrow   - moves selection bar to previous option left.  If inside a
                      pull-down menu, pressing this will cause wmbarget() to
                      return PDPREV.
        RightArrow  - moves selection bar to next option right.  If inside a
                      pull-down menu, pressing this will cause wmbarget() to
                      return PDNEXT.
        UpArrow     - moves selection bar to previous option up.
        DownArrow   - moves selection bar to next option down.  If pull-down
                      menus are being used and you are currently in the main
                      menu, then the option that the selection bar is on is
                      selected.
        Tab         - moves selection bar to next option right.
        Shift-Tab   - moves selection bar to previous option left.
        Enter       - selects the option that the selection bar is on.
        Home        - moves selection bar to upper left option.
        End         - moves selection bar to lower right option.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -