(SAT) Demo Application - addhost

Source Code

newScreen {{"Add Host"} 67x16}
addEntries {1,1 10
   {9,15 {Host focus alphanum} {Serial_No} {Company} {Model} {OS}}
   {11,8 {Processors int} {Speed_MHz int} {Memory_Mb int} {} {IP_Address 16 ip}}
}
addBorder {border 1,12 65x0}
addButtons {1,13 8 
   {Save {inserthost host serial_no company model os processors speed_mhz memory_mb ip_address} validate} 
   {43} 
   {+Back main}
}
unlock
Comments

This SAT/DL screen adds a new host to the demo database.

Called by: main


newScreen {{"Add Host"} 67x16}
Clear the screen/message line, set the application screen size to 67 characters by 16 rows, and set the window title to Display Host.
addEntries {1,1 10
   {9,15 {Host focus alphanum} {Serial_No} {Company} {Model} {OS}}
   {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 first entry has the focus and alphanum options set. The cursor will appear in this entry, which will be validated to check if the contents are alphanumeric (alphanum). The remaining three entries in the first column will accept any data. 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 {border 1,12 65x0}
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.
addButtons {1,13 8
   {Save {inserthost host serial_no company model os processors speed_mhz memory_mb ip_address} validate} 
   {43} 
   {+Back main}
}
Add a row of buttons with its top left corner at column 1, row 13. Each button is 8 characters wide. The row has two buttons: "Save" (runs inserthost with host, serial_no, company, model, os, processors, speed_mhz, memory_mb, ip_address as parameters), a 43 character gap, and "Back" (runs main). The validate option for the Save button causes all items to be validated when the button is "pressed".
unlock
As this screen doesn't have a process which returns data immediately, it is necessary to explicitly unlock the display.


Copyright © 2000 Adrian Davis.