Program User Buttons |
Top Previous Next |
This sequence programs the user buttons displayed with the Settings, User Defined Buttons option. ZTERM supports 40 user defined functions with ten displayed at a time.
Button numbers start at zero for the first button, User1 and continue to 39 for User39. Examples To program User1 with the caption "DIR", the tooltip "Display Directory" and command of DIR/W + CR: PRINT CHR$(27);CHR$(17); PRINT CHR$(0 + 32); PRINT "1"; PRINT "DIR";CHR$(0); PRINT "Display Directory";CHR$(0); PRINT "DIR/W";CHR$(13);CHR$(0); PRINT "000000";CHR$(0);
To program the Cancel Function Key followed by LOG + CR into User2, the function would be: PRINT CHR$(27);CHR$(17); PRINT CHR$(1 + 32); PRINT "1"; PRINT "LOG";CHR$(0); PRINT "Cancel and the LOG command";CHR$(0); PRINT CHR$(27);"LLOG";CHR$(13);CHR$(0); ! <ESC>L is cancel on an AM62A PRINT "120000";CHR$(0);
Other terminal emulators have this type of function, but rely on the PC user setting each of the user buttons. ZTERM requires the host system define the button functions so that they are set depending on the user and system. Therefore, it is recommended that the buttons are programmed as part of the user logon sequence. As an example, on a Unix machine, the "DIR" button might execute "ls -aF" whereas on AMOS, it would execute "dir/w". NOTE: When programming a large number of characters into the command field, be aware that ZTERM will send your string 100 characters at a time and then pause. Most host systems cannot handle a large burst of incoming data (especially over a telnet connection) and without the pause, the host will loose data. Flags Argument When most terminals send a function key sequence to the host computer, they send multiple keystrokes. For example on the Alpha Micro AM62A terminal the <ESC>L sequence is sent whenever the Cancel key is pressed. This leaves the designer of the operating system running on the host system in a bit of a predicament. Did the user actually type <ESC>L or was the cancel key pressed? Many host operating systems time how long it takes between the <ESC> and L arriving to determine if individual keys or a function key was pressed and then act appropriately. If you want to see this in action, try pressing <ESC>L on an Alpha Micro AM62A terminal when connected to AMOS. If you use this terminal (it's the only one that we've found to be fast enough to do this) and are able to type fast enough, you'll get a ^C instead of an <ESC>L! To make things even worse, when connecting to a host system like AMOS, it will only accept function keys if they are the first two characters in the packet when using a telnet connection - any others are passed through even if they are really meant to be function keys. When ZTERM 2000 is sending data that's been programmed into a User Button to the host, it has to know when to insert the appropriate pauses. The flags argument tells ZTERM 2000 when a series of characters should be processed as a function key sequence. The Flags Argument must be exactly the same length as the number of characters being programmed into a User Button - including all control characters. The three different values are:
If you need to easily find out how to program the escape sequences and Flags Arguments for your application, use the User Key capture facility when running your application. This function will generate the correct Flags Argument depending on function key usage and you can then just paste the sequence into your program. |