Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 3

Enable/Disable Next Based On SelectionTree

I have searched and searched for a definitive answer to this question, and finally produced the desired result!

Disable Next button on CustomSetup dialog if no features are chosen.
1. Next button events can certainly prevent the dialog from moving on
by defining event conditions that require at least one feature be chosen.
The Next button, however, remains enabled.
2. Next button conditions can set enable and disable based on the values
of each feature. However, the button does not process those conditions
until it's clicked. For example, both features are chosen when dialog
opens, so Next is enabled. If both features are then unchecked, Next
button remains enabled until it's actually clicked, then it reevaluates
the conditions and disables. If a feature is then chosen again, the
Next button remains disabled, with no way to force a reevaluation
of its conditions.
The SelectionTree can publish a SetProperty event that can be subscribed
to by the Next button, which enables and disables it as features are
chosen or eliminated, dynamically.
Add a New property named CUSTOMCHOICE, which will be treated as a
Boolean value of either 0 or 1.
Property Value
============ =====
Add two events to the SelectionTree itself (named: Tree), which will
set the value of CUSTOMCHOICE based on feature status. These SetProperty
events will be published by the SelectionTree, as documented in the
'SelectionTree Control' and 'SetProperty ControlEvent' Help file entries.
In this example, the project's InstallLevel is set at 3.
Event Argument Condition
============= ======= =========
[CUSTOMCHOICE] 1 (&Feature1=3) OR (&Feature2=3)
[CUSTOMCHOICE] 0 (NOT (&Feature1=3)) AND (NOT (&Feature2=3))
The Next button must have entries to both its conditions and subscriptions
to work as desired. As noted in PROBLEM 2, above, conditions alone produce
only static results. With the addition of a subscription, the effect
becomes dynamic. Though not listed in the dropdown list, 'SetProperty' is a
valid entry in the event column of the subscriptions list of the Next button.
Event Attribute
========= =========
SetProperty Enabled
Action Condition
===== =========
No change from standard.

With the above method, the Next button (or other control) reacts
dynamically to the choices made on the SelectionTree control.
It will flip on and off as you check and uncheck features.

I hope others can make use of this.
Labels (1)
(5) Replies
Level 4

Thank you very much, victorcamp!!!
You saved me tons of time!
Thank you again.
0 Kudos
Level 8


Thank you for the excellent post on Disable/Enable Next button.

I was wondering can you provide some information on how to use this Tree event "SelectionNoItems" ControlEvent and the way to subscribe it in other controls like button?
0 Kudos
Level 4

Thanks Victor
0 Kudos
Level 3

Thanks, Viktor, for a great solution. I've implemented your directions and they work great! I'm very happy about that. Your directions are clear, and here are also the contents of the MSI tables when exported as IDT files (using Orca). I've only included the lines that need to be changed to enable this functionality. Of course you must customize the Condition column of the ControlEvent table to list your own top-level MSI Features. But otherwise they can be copied verbatim.

[FONT="Courier New"]ControlCondition.idt
Dialog_ Control_ Action Condition
s72 s50 s50 s255
ControlCondition Dialog_ Control_ Action Condition
CustomSetup Next Disable CUSTOMCHOICE=0
CustomSetup Next Enable CUSTOMCHOICE=1

Dialog_ Control_ Event Argument Condition Ordering
s72 s50 s50 s255 S255 I2
ControlEvent Dialog_ Control_ Event Argument Condition
CustomSetup Tree [CUSTOMCHOICE] 0 &Feature1<>3 And &Feature2<>3 2
CustomSetup Tree [CUSTOMCHOICE] 1 &Feature1=3 Or &Feature2=3 1

Dialog_ Control_ Event Attribute
s72 s50 s50 s50
EventMapping Dialog_ Control_ Event
CustomSetup Next SetProperty Enabled

Property Value ISComments
s72 L0 S255
Property Property
Level 3

Thank you so much @victorcamp  and @chrismi ! Your detailed instructions helped a lot. 

0 Kudos