Archive: How to get information from checkboxes


How to get information from checkboxes
I'm sure you guys get tons of these messages, so I'll try and keep this as concise as possible.

I've added a new page using HM NSIS Editor. It's just a simple page with two checkboxes that asks if you want to add extra shortcuts. However, being largely code illiterate, I don't know how to get the information from the checkboxes back to use in my script. So, I'm asking:
Is there an easier way to do what I'm doing?
And, if not, how do I get the "yes/no" information back from a checkbox?

Cheers,
NikNaks


custom pages authored with HM NSIS Edit, at this time, will generate InstallOptions(2/Ex) type pages. What you would need to do is get the checkbox state from the ini file by using ReadIniStr .

Not necessarily easier (as I don't think there's an IDE/GUI for it yet) but certainly more flexible would be to look into nsDialogs.


Thanks for your reply. I'll look into the nsDialogs thing. Is there a page for that on the Wiki?


certainly
main wiki page:
http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html

page with further articles on usage:
http://nsis.sourceforge.net/Category:NsDialogs_Examples


Okay, thanks! I've managed to get my page to work much more quickly with that.

Just one last thing. Is there a way to grey out or otherwise disable the "Back" button on the finished page? I've got this new page right before it, and I don't want people going back as it would confuse them more than anything else. No biggie if I can't, though. I'm using the Modern UI 2, if that helps.

Thanks again for your help, Animaether!


sure you can - there's a callback in nsDialogs where you can prevent Back from working...

OnBack

nsDialogs::OnBack function_address

Sets the callback function for the Back button. This function will be called when the user clicks the back button. Call Abort in this function to prevent the user from going back to the last page.
But easier would indeed be to just disable the button, UI-wise.

GetDlgItem $0 $HWNDPARENT 3 ; 1 = Next, 2 = Cancel, 3 = Back
EnableWindow $0 0 ; 0 = Disable, 1 = Enable

Awesome! I really appreciate you taking time to help with this. But, of course, whenever you say "one last thing" it never is...

I've got the screen working and I can check and uncheck the boxes, and you can no longer go back on the last page. Great! Now, though, I've realised that the code to actually create the shortcuts isn't called for some reason, and they're never created. I'm not sure why, though.
On a side note, my new page uses the same title and subtext as the previous one. This wouldn't be an issue, except that the previous page is for the Start Menu, and I don't know how to edit the title for that. So I'd like to know if there's a way of changing that title, or fixing the original problem.
Also, there is a section of code which should mean that the installer waits for the uninstaller to run if the program is already found to exist (using ExecWait). However, both run simultaneously. I think I'm doing something wrong here.

So, I'd like to post my script, but I don't want to use up a lot of screen space. Are there spoiler tags or something similar I can put it in?


you can always attach the script as a file instead (not sure if that is currently available to you or whether you're in some probation period); otherwise, try pastebin.ca (you can put a password and time limit on it, if you want).

all of those problems should be able to be resolved; just a matter of knowing exactly what things you're referring to.. the title bits are probably just the MUI defines/macros you need to insert :)


Okay, it's on this link:

http://pastebin.ca/1393689