I think you can use << On Validate() for that.
Names Default To Here(1);
If(
ex = New Window("Dialog() example",
<<Modal,
<<Return Result,
<< On Validate(1 <= variable << get <= 4),
V List Box(
H List Box("Set this value", variable = Number Edit Box(42)),
H List Box(Button Box("OK"), Button Box("Cancel"))
)
);
ex["button"] == 1;
,
ex["variable"],
"CANCEL"
);
Edit:
Or did you mean greying out/disabling the button?
Names Default To Here(1);
If(
ex = New Window("Dialog() example",
<<Modal,
<< return result,
V List Box(
H List Box("Set this value", variable = Number Edit Box(42,
<< set function(
if(1 <= variable << get <= 4,
btn1 << enable(1),
btn1 << enable(0)
);
)
)),
H List Box(btn1 = Button Box("OK", << enable(0)), Button Box("Cancel"))
)
);
ex["button"] == 1;
,
ex["variable"],
"CANCEL"
);
-Jarmo