Page 1 of 1

How to use a variable to select a picture in a dialog?

Posted: Tue Jan 09, 2007 12:34 pm
by Christoph Schneegans
I'd like to display a different picture in a dialog if a certain (compiler) variable is set. Is it possible to achieve this? Or do I have to recreate the entire dialog and use script code such as

if Variable MyVar Equals TRUE
Display Dialog: dialog1
else
Display Dialog: dialog2
end

to display the dialog that shows the proper picture?

Posted: Wed Jan 10, 2007 5:29 pm
by MichaelNesmith
What you can do is place both pictures on the dialog, place an additional text field on the dialog and hide it, then set that text field's caption property to, for example, $FLAG$.

Now, in MSIcode, use Set Variable to pre-define FLAG to either TRUE or FALSE (just example values). Do this before showing the dialog.

And, back in the Dialog Editor, you can use Dialog Rules to show one of the pictures and hide the other when the value of the text field's caption (to which you assigned FLAG) is TRUE, and vice-versa. So no need to include two separate dialogs.

Posted: Thu Jan 11, 2007 4:26 am
by Christoph Schneegans
Works like a charm. Thanks a lot!

Posted: Wed Aug 01, 2007 9:52 am
by mmiron
What if we didn't want to or couldn't embed the images; so therefore we really wanted to specify the image via the command line at compile time?