PDA

View Full Version : Check Box Variables


eric_darling
09-24-2004, 01:50 PM
Quick LUA oriented question.

I tried figuring this one out on my own, but I can't seem to get this to work. I'm trying to have the installer check on the status of two checkboxes in my project. If they are checked, then the project should open external documents (one is plain txt and the other is pdf).

What am I doing wrong?

(this code appears in the screen's On Next event handler):
ReadMeResult = DlgCheckBox.GetProperties(CTRL_CHECK_BOX_01);
if ReadMeResult == "true" then
File.Open(SessionVar.Expand("%AppFolder%\\ReadMe.txt"), "", SW_SHOWNORMAL);
end

WhatsNewResult = DlgCheckBox.GetProperties(CTRL_CHECK_BOX_02);
if WhatsNewResult == "true" then
File.Open(SessionVar.Expand("%AppFolder%\\whats_new.pdf"), "", SW_SHOWNORMAL);
end

Screen.Next();

Brett
09-24-2004, 02:02 PM
The easier way is to use the Lua variable that was assigned to the checkbox in the Checkbox properties screen ("Store state in Lua variable" field). Then you just check for that variable rather than doing GetProperties. If you do want to use the DlgCheckBox.GetProperties action, keep in mind that a table is returned, not just the checked value:

ReadMeResult = DlgCheckBox.GetProperties(CTRL_CHECK_BOX_01);
if ReadMeResult.Checked == true then
File.Open(SessionVar.Expand("%AppFolder%\\ReadMe.txt"), "", SW_SHOWNORMAL);
end

eric_darling
09-24-2004, 02:06 PM
I see, it's a table.... Many thanks, Brett.

Ted Sullivan
09-27-2004, 10:20 AM
Darryl is currently working on a really handy "example project". It will contain some great examples on how to work with each of the screen types and should be available later this afternoon.