(SAT) Demo Application - displayhost |
Source Code |
newScreen {{"Display Host"} 67x26} addData {updated} addEntries {1,1 10 {9,15 {-Host} {-Serial_No} {-Company} {-Model} {OS focus}} {11,8 {Processors int} {Speed_MHz int} {Memory_Mb int} {} {IP_Address 16 ip}} } addBorder {Disks 1,12 65x0 title} addMultiList {disk 1,13 6 {ID,16 Size,8,numeric Type,6} copy(disk:id,disk:size,type) outline yscroll} addEntries {38,14 {6,6 {disk:ID alphanum} {disk:Size num}} } addButtons {38,19 8 {disk:Add validate(disk) {insertdisk host disk:id disk:size type}} {4} {disk:Delete {deletedisk host disk:id}} } addRadioButtons {Type 53,14 {+SCSI IDE} outline title} addBorder {border 1,22 65x0} addButtons {1,23 8 {Save validate() {updatehost host updated os processors speed_mhz memory_mb ip_address}} {Delete {deletehost host}} {+Print {printhost host}} {20} {+Back main} }
Comments |
This SAT/DL screen displays all details for the selected host.
newScreen {{"Display Host"} 67x26}Clear the screen/message line, set the application screen size to 67 characters by 26 rows, and set the window title to Display Host.
If this screen was to be called from main only it would not be necessary to set the size, however it can also be called by addhost which is smaller.
addData {updated}Add a data item called updated. The value of the "updated" column from the host entry in the database is stored here. This field is used to provide a simple locking mechinism (See updatehost).
addEntries {1,1 10 {9,15 {-Host} {-Serial_No} {-Company} {-Model} {OS focus}} {11,8 {Processors int} {Speed_MHz int} {Memory_Mb int} {} {IP_Address 16 ip}} }Add two columns of entry fields with its top left corner at column 1, row 1, with a 10 character gap between columns. The first column has a label text width of 9 characters and a default entry width of 15 characters. The second column has a label text width of 11 characters and a default entry width of 8 characters.
The names of the first four entry names in the first column are prefixed with "-". This causes the entries to be disabled (read only). The last ("OS") entry in the first column has the focus option set. This causes the cursor to appear in this entry. The first four entries in the second column have the int option set. These entries will be validated to check that the contents are an integer. The fourth entry is null, which leaves a one entry gap in the column. The last ("IP_Address") entry in the second column has an integer as the first option, which will override the default entry width. In this case it is set to 16 characters. The ip option will validate the entry to check that the contents match the pattern for an IP Address.
addBorder {Disks 1,12 65x0 title}Add a border with its top left corner at column 1, row 12. The border is 65 characters wide and 0 rows deep. A border which is zero rows deep is displayed as a horizontal line. The border, in this case a line, has the title option set, which displays the name of the border (Disks) overlayed at its lefthand end.
addMultiList {disk 1,13 6 {ID,16 Size,8,numeric Type,6} copy(disk:id,disk:size,type) outline yscroll}Add a multi-column list box called disk with its top left corner at column 1, row 13 which is 6 lines deep. The list box has three columns: "ID" (16 characters), "Size" (8 characters, with numeric justify), and "Type" (6 characters). When a disk is selected by single or double-click the copy option is invoked. In this case the first column is copied to the disk:id entry, the second column to the disk:size entry and the third to the type radio buttons. The list box has an outline and a vertical scrollbar (yscroll).
addEntries {38,14 {6,6 {disk:ID alphanum} {disk:Size num}} }Add a single column of entry fields with its top left corner at column 38, row 14, with a default ("5") character gap between columns. The column has a label text width of 6 characters and a default entry width of 6 characters.
The first entry has the alphanum option set. This entry will be validated to check if the contents are alphanumeric. The second entry has the num option set. This entry will be validated to check if the contents are numeric.
When an item name contains ":" the characters to the left are the prefix (which is not displayed). The characters to the right are the actual label to be shown, if applicable. This allows more than one button to have the same visible name and, as in this case, to group items for validation purposes.
addButtons {38,19 8 {disk:Add validate(disk) {insertdisk host disk:id disk:size type}} {4} {disk:Delete {deletedisk host disk:id}} }Add a row of buttons with its top left corner at column 38, row 19. Each button is 8 characters wide. The row has two buttons: "disk:Add" (runs insertdisk with host, disk:id, disk:size, type as parameters), a 4 character gap, and "disk:Delete" (runs deletedisk with host, disk:id as parameters). The validate(disk) option for the disk:Add button causes all items prefixed with disk to be validated when the button is "pressed".
addRadioButtons {Type 53,14 {+SCSI IDE} outline title}Add a group of radio buttons called Type with its top left corner at column 53, row 14. The group has two buttons: SCSI and IDE. The "+" prefix causes the SCSI button to be activated. The radio buttons have an outline and the title option is set, which displays the name of the radio buttons (Type) overlayed at its top left.
addBorder {border 1,22 65x0}Add a border with its top left corner at column 1, row 22. The border is 65 characters wide and 0 rows deep. A border which is zero rows deep is displayed as a horizontal line.
addButtons {1,23 8 {Save validate() {updatehost host updated os processors speed_mhz memory_mb ip_address}} {Delete {deletehost host}} {+Print {printhost host}} {20} {+Back main} }Add a row of buttons with its top left corner at column 1, row 23. Each button is 8 characters wide. The row has four buttons: "Save" (runs updatehost with host, updated, os, processors, speed_mhz, memory_mb, ip_address as parameters), "Delete" (runs deletehost with host as parameter, "Print" (runs printhost with host as parameter), a 20 character gap, and "Back" (runs main). The validate() option for the Save button causes all items without a prefix to be validated when the button is "pressed". The "Print" and "Back" buttons (prefixed with "+") are always active.