Form DEMO_COMMAND_RECALL_FORM /* © Copyright 2005 Hewlett-Packard Development Company, L.P. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. This IFDL file is designed to be translated and then simply enabled in order to see the effect. Just enter commands and use the up/down arrow keys to scroll. There is no program behind this form to execute the commands but you should get the idea of command recall from what you see on the display. keys: RETURN -- simulates going back to the program but really just displays a message and scrolls to the next command line after clearing it. F10 exit (ends session in this demo) TAB goes to next line of command BS goes to previous line of command UP ARROW scrolls to previous command DOWN ARROW scrolls to next command */ Form Data STYLE Character(3) RECALL_STYLE_TEXT Character(50) CRC_STYLE_TEXT Character(50) Value "using a circular buffer of size 12 entries. " VMS_STYLE_TEXT Character(50) Value "using VMS-style recall of up to 12 entries. " COMMAND_CHARS Character(36) COMMAND_LINE_1 Character(69) COMMAND_LINE_2 Character(80) Group COMMAND_LINES Occurs 12 CURRENT_LINE_NBR Integer(2) COMMAND_LINE_1 Character(69) COMMAND_LINE_2 Character(80) PREVIOUS_INDEX Byte Integer NEXT_INDEX Byte Integer End Group COMMAND_INDEX Byte Integer COMMAND_POINTER Byte Integer End Data Form Record MENU_SELECTION /* This form record would be used in a RECEIVE request to get the current command selection back from the form to the program. Note the use of the TRANSFER ... SOURCE ... clause, this moves the current command line (the one visible to the user) to the form record area. */ Group CURRENT_COMMAND COMMAND_LINE_1 Character(69) Transfer CURRENT_COMMAND.COMMAND_LINE_1 Source COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 COMMAND_LINE_2 Character(80) Transfer CURRENT_COMMAND.COMMAND_LINE_2 Source COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_2 End Group End Record Layout VT_LAYOUT Device Terminal Type %VT100 End Device Size 24 Lines by 80 Columns Viewport MENU_VP Lines 1 Through 23 Columns 1 Through 80 End Viewport Viewport INFO_VP Lines 1 Through 21 Columns 1 Through 80 End Viewport Viewport SELECT_LINE_VIEW Lines 22 Through 23 Columns 1 Through 80 End Viewport Function SHOW_VALUES Is %F9 End Function Function MENU_SELECT Is %SELECT End Function Function DO_COMMAND Is %CARRIAGE_RETURN End Function Function RECALL Is %FIND /* not yet implemented */ End Function Function NEXT ITEM Is %HORIZONTAL_TAB End Function Function UP ITEM Is %UP End Function Function DOWN ITEM Is %DOWN End Function Function COMMAND_UP Is %UP End Function Function COMMAND_DOWN Is %DOWN End Function Function INIT_COMMANDS Is %F18 End Function Function CLEAR_COMMANDS Is (%PF1 %F18) End Function Function DO_IT_AGAIN Is %F19 End Function Function CLEAR_MESSAGE_AREA Is %F20 End Function Internal Response SETUP_SCROLL_CONTROL Let COMMAND_LINES(1).CURRENT_LINE_NBR = 1 Let COMMAND_LINES(1).PREVIOUS_INDEX = 12 Let COMMAND_LINES(1).NEXT_INDEX = 2 Let COMMAND_LINES(2).CURRENT_LINE_NBR = 2 Let COMMAND_LINES(2).PREVIOUS_INDEX = 1 Let COMMAND_LINES(2).NEXT_INDEX = 3 Let COMMAND_LINES(3).CURRENT_LINE_NBR = 3 Let COMMAND_LINES(3).PREVIOUS_INDEX = 2 Let COMMAND_LINES(3).NEXT_INDEX = 4 Let COMMAND_LINES(4).CURRENT_LINE_NBR = 4 Let COMMAND_LINES(4).PREVIOUS_INDEX = 3 Let COMMAND_LINES(4).NEXT_INDEX = 5 Let COMMAND_LINES(5).CURRENT_LINE_NBR = 5 Let COMMAND_LINES(5).PREVIOUS_INDEX = 4 Let COMMAND_LINES(5).NEXT_INDEX = 6 Let COMMAND_LINES(6).CURRENT_LINE_NBR = 6 Let COMMAND_LINES(6).PREVIOUS_INDEX = 5 Let COMMAND_LINES(6).NEXT_INDEX = 7 Let COMMAND_LINES(7).CURRENT_LINE_NBR = 7 Let COMMAND_LINES(7).PREVIOUS_INDEX = 6 Let COMMAND_LINES(7).NEXT_INDEX = 8 Let COMMAND_LINES(8).CURRENT_LINE_NBR = 8 Let COMMAND_LINES(8).PREVIOUS_INDEX = 7 Let COMMAND_LINES(8).NEXT_INDEX = 9 Let COMMAND_LINES(9).CURRENT_LINE_NBR = 9 Let COMMAND_LINES(9).PREVIOUS_INDEX = 8 Let COMMAND_LINES(9).NEXT_INDEX = 10 Let COMMAND_LINES(10).CURRENT_LINE_NBR = 10 Let COMMAND_LINES(10).PREVIOUS_INDEX = 9 Let COMMAND_LINES(10).NEXT_INDEX = 11 Let COMMAND_LINES(11).CURRENT_LINE_NBR = 11 Let COMMAND_LINES(11).PREVIOUS_INDEX = 10 Let COMMAND_LINES(11).NEXT_INDEX = 12 Let COMMAND_LINES(12).CURRENT_LINE_NBR = 12 Let COMMAND_LINES(12).PREVIOUS_INDEX = 11 Let COMMAND_LINES(12).NEXT_INDEX = 1 End Response Internal Response DO_RECALL_DEMO Remove All Display INFO_PANEL on INFO_VP If (STYLE = "VMS") Then Activate Panel VMS_PANEL End If If (STYLE = "CRC") Then Activate Panel CRC_PANEL End If Position To Next Item End Response Internal Response RESTART_DEMO Let COMMAND_INDEX = 1 Let COMMAND_POINTER = 1 Activate Panel MENU_PANEL Position To First Item End Response Enable Response Include SETUP_SCROLL_CONTROL Include RESTART_DEMO End Response Function Response DO_IT_AGAIN Message " " Include RESTART_DEMO End Response Function Response CLEAR_MESSAGE_AREA Message "" End Response Function Response NEXT PANEL End Response Function Response PREVIOUS PANEL End Response Function Response SHOW_VALUES If (STYLE = "VMS") Then Message "command index = " COMMAND_INDEX " command ptr = " COMMAND_POINTER Else Message "command index = " COMMAND_INDEX End If End Response Function Response INIT_COMMANDS Let COMMAND_LINES(1).COMMAND_LINE_1 = "Form Develop Account "- "/output=(IFDL,form=New_Account)/panel=address" Let COMMAND_LINES(1).COMMAND_LINE_2 = "/checkpoint=new_account" Let COMMAND_LINES(2).COMMAND_LINE_1 = "Form Edit Inventory "- "/command=user$disk:[project.common]ped_modify" Let COMMAND_LINES(2).COMMAND_LINE_2 = "/panel=authorize" Let COMMAND_LINES(3).COMMAND_LINE_1 = "Form Translate Order_entry "- "/diagnostics/output=user$disk:[smith.devel" Let COMMAND_LINES(3).COMMAND_LINE_2 = "op]order_entry_test" Let COMMAND_LINES(4).COMMAND_LINE_1 = "Form Extract Object "- "Account /layout=French /list /object=user$disk:[j" Let COMMAND_LINES(4).COMMAND_LINE_2 = "ones.forms.obj]" Let COMMAND_LINES(5).COMMAND_LINE_1 = "" Let COMMAND_LINES(5).COMMAND_LINE_2 = "" If (STYLE = "VMS") Then Let COMMAND_LINE_1 = "" Let COMMAND_LINE_2 = "" End If Let COMMAND_INDEX = 5 Let COMMAND_POINTER = 5 End Response Function Response CLEAR_COMMANDS Reset COMMAND_LINES Include SETUP_SCROLL_CONTROL End Response Panel CRC_PANEL Viewport SELECT_LINE_VIEW /* Style = "CRC": Provide command recall on up to 16 lines using a circular buffer in the form. The items previous_index and next_index are not displayed on the screen but are used to change the value of the command_index. This method does away with the need for calling a procedural escape which would otherwise be needed to do a plus/minus 1 calculation. The command input area is two lines where getting to the end of the first line causes autoskip to the second line. This 2 line display provides up to 149 characters of command. This "restriction" is merely due to wanting to keep to only 2 lines on the display. It could be extended easily by adding an additional line to the group. */ Entry Response Let COMMAND_INDEX = 1 End Response Function Response DO_COMMAND Let COMMAND_CHARS = COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 Message "command beginning >" COMMAND_CHARS "< has been dispatched." Let COMMAND_INDEX = COMMAND_LINES(COMMAND_INDEX).NEXT_INDEX Reset COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 Reset COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_2 Position To Field COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 On CRC_PANEL End Response Function Response COMMAND_UP Let COMMAND_INDEX = COMMAND_LINES(COMMAND_INDEX).PREVIOUS_INDEX Position To Field COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 On CRC_PANEL End Response Function Response COMMAND_DOWN Let COMMAND_INDEX = COMMAND_LINES(COMMAND_INDEX).NEXT_INDEX Position To Field COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 On CRC_PANEL End Response Group COMMAND_LINES Vertical Displays 1 First COMMAND_INDEX /* The literal is inside the group so that a full two lines are scrolled. This is more efficient in that we can use hardware scrolling where that is available in the terminal. */ Literal Text Line 1 Column 1 Value "Selection>" End Literal Field COMMAND_LINE_1 Same Line Column 12 Function Response BOUNDARY CURSOR RIGHT Position Immediate To Next Item End Response Autoskip Output Picture X(69) End Field Field COMMAND_LINE_2 Next Line Column 1 Function Response BOUNDARY CURSOR LEFT Position Immediate To Previous Item End Response Output Picture X(80) End Field End Group End Panel Panel VMS_PANEL Viewport SELECT_LINE_VIEW /* Style = "VMS": Provide command recall on up to 16 lines using VMS_style command recall. The previous/next index are used to maintain an internal pointer which is then used to move a command from the internal buffer to the display area. The command input area is two lines where getting to the end of the first line causes autoskip to the second line. This 2 line display provides up to 149 characters of command. This "restriction" is merely due to wanting to keep to only 2 lines on the display. It could be extended easily by adding an additional line to the group. */ Entry Response Let COMMAND_INDEX = 1 Let COMMAND_POINTER = 1 End Response Function Response DO_COMMAND Let COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 = COMMAND_LINE_1 Let COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_2 = COMMAND_LINE_2 Let COMMAND_CHARS = COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 Message "command beginning >" COMMAND_CHARS "< has been dispatched." Let COMMAND_POINTER = COMMAND_LINES(COMMAND_INDEX).NEXT_INDEX Let COMMAND_INDEX = COMMAND_LINES(COMMAND_INDEX).NEXT_INDEX Reset COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_1 Reset COMMAND_LINES(COMMAND_INDEX).COMMAND_LINE_2 Reset COMMAND_LINE_1 Reset COMMAND_LINE_2 Position To Field COMMAND_LINE_1 On VMS_PANEL End Response Function Response COMMAND_UP Let COMMAND_POINTER = COMMAND_LINES(COMMAND_POINTER).PREVIOUS_INDEX Let COMMAND_LINE_1 = COMMAND_LINES(COMMAND_POINTER).COMMAND_LINE_1 Let COMMAND_LINE_2 = COMMAND_LINES(COMMAND_POINTER).COMMAND_LINE_2 End Response Function Response COMMAND_DOWN Let COMMAND_POINTER = COMMAND_LINES(COMMAND_POINTER).NEXT_INDEX Let COMMAND_LINE_1 = COMMAND_LINES(COMMAND_POINTER).COMMAND_LINE_1 Let COMMAND_LINE_2 = COMMAND_LINES(COMMAND_POINTER).COMMAND_LINE_2 End Response Literal Text Line 1 Column 1 Value "Selection>" End Literal Field COMMAND_LINE_1 Same Line Column 12 Function Response BOUNDARY CURSOR RIGHT Position Immediate To Next Item End Response Autoskip Output Picture X(69) End Field Field COMMAND_LINE_2 Next Line Column 1 Function Response BOUNDARY CURSOR LEFT Position Immediate To Previous Item End Response Output Picture X(80) End Field End Panel Panel INFO_PANEL Literal Text Line 3 Column 13 Value "Demonstration of command recall from within a form" End Literal Field RECALL_STYLE_TEXT Line 4 Column 13 Output Picture X(50) Protected End Field Literal Text Line 6 Column 1 Value "The command input area below comprises two lines of "- "entry for a single command." End Literal Literal Text Line 7 Column 1 Value 'This allows 149 characters per command. This '- '"restriction" is merely due to the' End Literal Literal Text Line 8 Column 1 Value "desire to only use 2 lines on the display." End Literal Literal Text Line 8 Column 44 Value "If you want more characters in your" End Literal Literal Text Line 9 Column 1 Value "command line then use more lines on the display." End Literal Literal Text Line 11 Column 1 Value "Keys:" End Literal Literal Text Line 12 Column 7 Value "RETURN simulates going back to the program with the "- "current command" End Literal Literal Text Line 13 Column 14 Value "line but really just displays a message and scrolls" End Literal Literal Text Line 14 Column 7 Value "F10 exits from the demo" End Literal Literal Text Line 15 Column 7 Value "TAB goes to next line of the command" End Literal Literal Text Line 16 Column 7 Value "BS goes to previous line of the command" End Literal Literal Text Line 17 Column 7 Value "UP ARROW scrolls to the previous command" End Literal Literal Text Line 18 Column 7 Value "DOWN ARROW scrolls to the next command" End Literal Literal Text Line 19 Column 7 Value "F18 will setup some sample commands while PF1-F18 will "- "clear the buffer" End Literal Literal Text Line 20 Column 7 Value "F19 will re-start the demo. F20 will clear the message "- "line" End Literal End Panel Panel MENU_PANEL Viewport MENU_VP Function Response MENU_SELECT If (STYLE = "VMS") Then Let RECALL_STYLE_TEXT = VMS_STYLE_TEXT End If If (STYLE = "CRC") Then Let RECALL_STYLE_TEXT = CRC_STYLE_TEXT End If Include DO_RECALL_DEMO End Response Literal Text Line 4 Column 9 Value "This form demonstrates how Groups may be used in "- "DECforms to" End Literal Literal Text Line 5 Column 9 Value "provide entry and editing of commands including "- "command recall." End Literal Literal Text Line 7 Column 9 Value "There are two types of command recall demonstrated here:" End Literal Literal Text Line 9 Column 26 Value "where you may go back to previous commands to select" End Literal Literal Text Line 10 Column 26 Value "a new command and then the one you select is added to" End Literal Literal Text Line 11 Column 26 Value "the end of the list of selectable commands." End Literal Literal Text Line 13 Column 26 Value "where the commands are stored in a circular buffer" End Literal Literal Text Line 14 Column 25 Value " and you directly edit the command you select. In this" End Literal Literal Text Line 15 Column 25 Value " model, whatever is the next command in the buffer is" End Literal Literal Text Line 16 Column 25 Value " then cleared and becomes the next command line." End Literal Literal Text Line 18 Column 9 Value "Use the arrow keys to move between the highlighted "- "items and press" End Literal Literal Text Line 19 Column 9 Value "Select on the one you would like to see demonstrated." End Literal Literal Text Line 21 Column 9 Value "At any time, you may press F10 or cntrl/Z to leave "- "this demo." End Literal Icon VMS_STYLE Entry Response Let STYLE = "VMS" End Response Active Highlight Bold Literal Text Line 9 Column 8 Value " VMS-style " Display Reverse End Literal End Icon Icon CIRC_BUFFER_STYLE Entry Response Let STYLE = "CRC" End Response Active Highlight Bold Literal Text Line 13 Column 8 Value " Circular buffer " Display Reverse End Literal End Icon End Panel End Layout End Form