Hi,
I have a dialog in which a field (a textbox) is steered by another field (a checkbox).
If the checkbox is "checked" then the textbox is enabled and a user must provide a value to that field.
Now my question is: how to disable the next button if the user didn't provide the textbox value?
In pseudo language it would be:
if (checkbox.Enabled AND textbox.Text == "")
Next.Enabled = False
How to achieve that using the dialog object rules? I see only one condition there...
Best regards,
adi
How to check two conditions in the dialog object rules?
-
- Posts: 3452
- Joined: Thu Dec 22, 2005 7:17 pm
- Contact:
Re: How to check two conditions in the dialog object rules?
You can always add more rules. I suggest you check some of the built-in dialogs in the themes and sample projects to see examples of how its done.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
Re: How to check two conditions in the dialog object rules?
Hello,
Thank you for your answer, but I think that you didn't understand what I meant, or I wasn't clear enough.
Of course I can add more rules, but from what I've seen: 1 rule can check for one condition only.
And what I want to achieve is to check for more condition in the same rule:
I've checked all the sample projects and I didn't find anything even close to my case (which is in the end rather basic).
Is this a limitation of InstallAware? Or I don't understand the object rules dialog?
Best regards,
adi
Thank you for your answer, but I think that you didn't understand what I meant, or I wasn't clear enough.
Of course I can add more rules, but from what I've seen: 1 rule can check for one condition only.
Code: Select all
if ControlA has property PropA equal to ValueA
do something
And what I want to achieve is to check for more condition in the same rule:
Code: Select all
if (ControlA has property PropA equal to ValueA) AND (ControlB has property PropB equal to ValueB)
do something
I've checked all the sample projects and I didn't find anything even close to my case (which is in the end rather basic).
Is this a limitation of InstallAware? Or I don't understand the object rules dialog?
Best regards,
adi
Re: How to check two conditions in the dialog object rules?
Hi!
You can achieve that actually.
Place some hidden Lablel control on the form (Visible = false), let's name it lblCondition.
Then type the condition like:
IF A then lblCondition.Caption = TRUE
IF not A then lblCondition.Caption = FALSE
IF B then lblCondition.Caption = TRUE
IF not B then lblCondition.Caption = FALSE
... all other conditions to test that should be take to consider
e.t.c.
A and B certain conditions to test
and now the final part: check for that lblCondition.Caption inside another condition
IF lblCondition.Caption equals TRUE then do something
I hope you got my idea!
Hope this helps!
You can achieve that actually.
Place some hidden Lablel control on the form (Visible = false), let's name it lblCondition.
Then type the condition like:
IF A then lblCondition.Caption = TRUE
IF not A then lblCondition.Caption = FALSE
IF B then lblCondition.Caption = TRUE
IF not B then lblCondition.Caption = FALSE
... all other conditions to test that should be take to consider
e.t.c.
A and B certain conditions to test
and now the final part: check for that lblCondition.Caption inside another condition
IF lblCondition.Caption equals TRUE then do something
I hope you got my idea!
Hope this helps!
Re: How to check two conditions in the dialog object rules?
ALive wrote:Hi!
Place some hidden Lablel control on the form (Visible = false), let's name it lblCondition.
Then type the condition like:
IF A then lblCondition.Caption = TRUE
IF not A then lblCondition.Caption = FALSE
IF B then lblCondition.Caption = TRUE
IF not B then lblCondition.Caption = FALSE
... all other conditions to test that should be take to consider
e.t.c.
Hi,
Thank you for your answer. I got the point. Now using the hidden label I'm able to simulate multiple checks. The only thing is that you have to be careful with the conditions checking order (they are checked one after another). In the example you provided it won't work:
A - false
B - true
lblCondition.Caption = (initial state, empty string)
1. IF A then lblCondition.Caption = TRUE
- no change to lblCondition.Caption
2. IF not A then lblCondition.Caption = FALSE
- lblCondition.Caption set to FALSE
3. IF B then lblCondition.Caption = TRUE
- lblCondition.Caption set to TRUE... (here it fails)
4. IF not B then lblCondition.Caption = FALSE
- no change to lblCondition.Caption
As you can see - the second condition will override the first one.
Solution - swap checks number 2 and 3 and it will be fine.
It gets really complicated when you put more controls on the form. More hidden labels are needed then.
Best regards,
adi
Who is online
Users browsing this forum: No registered users and 57 guests