Sample 1 Centigrade Fahrenheit

Steps_recommanded() FUNCTION Steps_recommanded() SYSTEM(BackGround=998, FontSize=20) ! Hit the ENTER key to proceed DLG(Edit='#Welcome', Button='OK')
#Welcome . Your first HicEst script is just running. . Nobody likes to read manuals. . The following code snippets do not replace a manual, . but hopefully they will be of some help to you. . To get the most of it, please single-step through this script . (either use "Enter" key or the Step-Menu) . In this script you will . see simple expressions to handle Celsius/Fahrenheit conversion. . meet your first DLG() function calls . run 2 DO loops. . Main thing: . TO PLAY WITH THE CODE IS AS EASY AS WRITING A MAIL. . Next: . Hit "Enter" to execute a line.

SYSTEM(RUN = 0) ! STOPs auto-RUN mode DLG(Edit='#NeedToKnow', Button='OK')

#NeedToKnow . EXECUTE a line of code: . "Enter" or "Menu-Step" . RUN the code: "Menu-Run" . Create a NEW LINE: . "Ctrl + Enter" . or "ENTER" after a LineEnd followed by a space . The F1 key or a right mouse click for context sensitive HELP . . You may want to know: . When the script is started, Line 1 is ALWAYS executed. It may be blank. . If line 1 is a FUNCTION call, this provides a self-starting Run. . The number of leading TABS in line 1 determines the indent of the script.
DLG(Edit='#Samples', Button='OK')
#Samples . Samples are packed with more or less useless stuff. . It is thought you PLAY AROUND with the code to see how HicEst works. . Next: . Convert centigrades °C to Fahrenheit °F . Convert Fahrenheit °F to centigrades °C . You may want to know: . With OK in a button text, the ENTER key will work like an OK.
Fahrenheit = 9 * Centigrade / 5 + 32 ! The base algorithm (in case you forgot) DLG(Edit='#Explain', Button='OK')
#Explain . You need to know: . Numerical and string variables need no declaration . Numerical values are = 0 initially . String values are initially set to null = "" . DLG() talks with the user: it serves to show and edit variables . If there is a result it is written in the report column . A leading dot makes the line a comment . A ! anywhere makes the folling part of a line a comment . You may want to know: . A # in column1 starts the uncompiled APPENDIX section . #text in column1 makes text the name of an appendix chapter . #text helps to keep the script free of lengthy texts . myText = #text ! sets myText to the contents of #text
. For more interaction use DLG(): DLG(LaBeL='This label tells you to set C to', NumEdit=C, Button='Calculate F with THIS Button') F = 9 * C / 5 + 32 DLG(LBL='The conversion of' && C & '°C is' && F & '°F', B='OK') DLG(Edit='#LaBeL_(Num)Edit_Button', Button='OK')
#LaBeL_(Num)Edit_Button You need to know: . NumEdit is to edit numerical values . Edit is to edit string (text) values . Edit=myfile opens myfile in ReadOnly mode The DLG controls are: . Array, AXis, Button, CHeckbox, ComboBox, Edit, Image, . Label, ListBox, Numedit, RadioButton, ToolTip You may want to know: . "&" and "&&" is the "+" for strings, . but with "&" strings and numerics may be mixed . Only the capital letters of a keyword are needed, . eg "B" instead "Button"
. use a DO loop for multiple tries: DO F = 9 * C / 5 + 32 ! Base algorithm again as F(C) CtoF = 'Converted' && C & '°C to' && F & '°F ||| Next convert °C =' DLG(LBL=CtoF, NumEdit=C, But='OK', B='Next') IF($txtRC == 'Next') EXIT ENDDO DLG(Edit='#DOloops', Button='OK')
#DOloops . You need to know: . Besides a standalone, DO can also be: . DO i=nr . DO j=from,to . DO k=from,to,stepsize You may want to know: . In DLG commands "|" stands for a new line. . Line breaks are possible after any of . ',' ';' '=' '|' '.' . In DLG the default is to continue vertically. . Terminate a control with X=xPos to continue horizontally, . terminate with Y=yPos to continue vertically.
DO F = 9 * fromC / 5 + 32 C = 5 * (fromF - 32) / 9 CtoF = '°C converted to °F equals' && F FtoC = fromF && '°F converted to °C equals' && C DLG(NE=fromC, LBL=CtoF, NE=fromF, Y=1, X=0, LBL=FtoC, B='_Next', B='_OK', B='_Format', LBL='Why dont you try it with -40°') IF($txtRC == '_Next') EXIT IF($txtRC == '_Format') Ffmtd = FMT(F, 'F0') ! F1 or right mouse over FMT shows options Cfmtd= FMT(C, 'F2') DLG(N= C,SYM, E=Cfmtd,SYM, NE=F,SYM, E=Ffmtd,SYM, B='OK', LBL="C formatted with FMT(C, 'F2')", LBL="F formatted with FMT(F, 'F0')") ENDIF ENDDO DLG(Edit='#Finito', Button='Quit', LaBeL='Press ESCape instead to see the code')
#Finito . This was lots of text. . The next demos will show a little more action.
IF($txtRC == 'Quit') SYSTEM(QUIT=1) END