Dialog if examples: Difference between revisions

From Macros Wiki
Jump to navigationJump to search
CatoH (talk | contribs)
Created page with " ===INPUT example with IF statement === first_var=1 :if first_var=1 then INPUT 65, 017, 70, 24, w1, 10 will only show the input box when first_var = 1 :first_var=1 :second_var=1 :if first_var=1 then if second_var=1 then INPUT 65, 017, 70, 24, w1, 10 will only show the input box when first_var = 1 and second_var = 1 ===CHECK example with IF statement === :first_var=1 :if first_var=1 then CHECK 070, 044, 070, 24, "Cross", dir1, 0 will only show the check box wh..."
 
CatoH (talk | contribs)
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
You can use conditional IF statements to control most of the dialog elements and commands inside a dialog window.


===INPUT example with IF statement ===
===INPUT example with IF statement ===
<pre>
first_var=1
first_var=1
if first_var=1 then INPUT 65,  017, 70, 24, w1, 10
</pre>
will only show the input box when <b>first_var = 1</b>


:if first_var=1 then INPUT 65,  017, 70, 24, w1, 10
<pre>
 
first_var=1
will only show the input box when first_var = 1
second_var=1
 
if first_var=1 then if second_var=1 then INPUT 65,  017, 70, 24, w1, 10
:first_var=1
</pre>
:second_var=1
will only show the input box when <b>first_var = 1 and second_var = 1</b>
:if first_var=1 then if second_var=1 then INPUT 65,  017, 70, 24, w1, 10
 
will only show the input box when first_var = 1 and second_var = 1




===CHECK example with IF statement ===
===CHECK example with IF statement ===
:first_var=1
<pre>
first_var=1
if first_var=1 then CHECK 070,  044, 070, 24, "Cross", dir1,  0
</pre>
will only show the check box when <b>first_var = 1</b>


:if first_var=1 then CHECK 070,  044, 070, 24, "Cross", dir1,  0
<pre>
 
first_var=1
will only show the check box when first_var = 1
second_var=1
if first_var=1 then if second_var=1 then CHECK 070,  044, 070, 24, "Cross", dir1,  0
</pre>
will only show the check box when <b>first_var = 1 and second_var = 1</b>


:first_var=1
===IMAGE example with IF statement ===
:second_var=1
<pre>
:if first_var=1 then if second_var=1 then CHECK 070, 044, 070, 24, "Cross", dir1, 0
is_inch=1
if is_inch=1 then IMAGE 265, 35, 100, 100, "inch.bmp"
if is_inch=0 then IMAGE 265, 35, 100, 100, "metric.bmp"
</pre>
when the variable <b>is_inch=1</b>, show image "inch.bmp", if variable <b>is_inch=0</b> then show image "metric.bmp"


will only show the check box when first_var = 1 and second_var = 1
===IMAGE example with IF statement and using ON_EVENT ===
<pre>
is_inch=1
if is_inch=1 then IMAGE 265, 35, 100, 100, "inch.bmp"
if is_inch=0 then IMAGE 265, 35, 100, 100, "metric.bmp"
ON_EVENT radio1, image1,show
</pre>
Will display <b>image1</b> only if <b>radio1</b> button is selected, <b>image1</b> will hold either "inch.bmp" or "metric.bmp" based on if the variable <b>is_inch</b> is 0 or 1

Latest revision as of 10:45, 24 March 2025


You can use conditional IF statements to control most of the dialog elements and commands inside a dialog window.

INPUT example with IF statement

first_var=1
if first_var=1 then INPUT 65,  017, 70, 24, w1, 10

will only show the input box when first_var = 1

first_var=1
second_var=1
if first_var=1 then if second_var=1 then INPUT 65,  017, 70, 24, w1, 10

will only show the input box when first_var = 1 and second_var = 1


CHECK example with IF statement

first_var=1
if first_var=1 then CHECK 070,  044, 070, 24, "Cross", dir1,  0

will only show the check box when first_var = 1

first_var=1
second_var=1
if first_var=1 then if second_var=1 then CHECK 070,  044, 070, 24, "Cross", dir1,  0

will only show the check box when first_var = 1 and second_var = 1

IMAGE example with IF statement

is_inch=1
if is_inch=1 then IMAGE 265, 35, 100, 100, "inch.bmp"
if is_inch=0 then IMAGE 265, 35, 100, 100, "metric.bmp"

when the variable is_inch=1, show image "inch.bmp", if variable is_inch=0 then show image "metric.bmp"

IMAGE example with IF statement and using ON_EVENT

is_inch=1
if is_inch=1 then IMAGE 265, 35, 100, 100, "inch.bmp"
if is_inch=0 then IMAGE 265, 35, 100, 100, "metric.bmp"
ON_EVENT radio1, image1,show

Will display image1 only if radio1 button is selected, image1 will hold either "inch.bmp" or "metric.bmp" based on if the variable is_inch is 0 or 1