How to check two conditions in the dialog object rules?

Got a problem you cannot solve? Try here.
adi
Posts: 57
Joined: Mon Mar 22, 2010 8:28 am

How to check two conditions in the dialog object rules?

Postby adi » Wed Mar 24, 2010 4:46 am

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

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: How to check two conditions in the dialog object rules?

Postby MichaelNesmith » Wed Mar 24, 2010 1:27 pm

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/

adi
Posts: 57
Joined: Mon Mar 22, 2010 8:28 am

Re: How to check two conditions in the dialog object rules?

Postby adi » Mon Mar 29, 2010 9:29 am

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.

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

ALive
Posts: 109
Joined: Mon Apr 27, 2009 5:54 am
Location: Russia

Re: How to check two conditions in the dialog object rules?

Postby ALive » Fri Apr 02, 2010 5:59 am

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!

adi
Posts: 57
Joined: Mon Mar 22, 2010 8:28 am

Re: How to check two conditions in the dialog object rules?

Postby adi » Mon Apr 12, 2010 3:18 am

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


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 57 guests