Skip to content
⌘ NSIS Forum Archive

Disable buttons, do some processing and re-enable buttons

3 posts

sebarnolds#

Disable buttons, do some processing and re-enable buttons

Hi !

I'm currently writing a quite complex installer. I proprose some choices to the user, each choice proprosed through a single separate page. I currently process each choice when the user clicks the "next" button of the corresponding page. However the processing can be long (I extract files from a zip archive via the nsisunz plugin).

However I discovered that I could click the "next" button while the processing was in progress (NSIS currently in the nsisunz extracting function). So it seems like if I was able to launch the extraction twice... and the whole application crashes on a Windows fatal error.

I thought I would be able to disable the buttons, extract everything and then enable them. I found how to do it in this forums. However it seems it doesn't work in my case. The buttons get disabled when using as "disable/enable buttons -> exit function" but they don't when using as "disable buttons -> call nsisunz -> enable buttons -> exit function". It seems that the window messages aren't handled (I suppose they are handled when I exit the function... too late).

A solution would be to collect all choices and then have a progress page (all buttons would be disabled in the PRE function). Then, when the processing would be finished, they would be re-enabled. However this would require me to rewrite some big parts of my installer script.

Does anybody know how I could handle this problem ?

Thansk forward,
Seb
Afrow UK#
You shouldn't do any processing until the InstFiles page, where you should do processing in Sections. Most people don't think about this... but what if you extract files in a custom page and then the user chooses to cancel the setup afterwards. You've either got to delete these files, or let the user do it fumble over it.

-Stu
sebarnolds#
Hi.

Thanks for your reply. I agree with you about the processing which must be done in the InstFiles page. However in the case I described, the processing was done in a page AFTER the InstFiles.

Anyway I was doing a lot of stuff before the InstFiles page and I was doing also a bunch of stuff on pages after the InstFiles page. I rewrote everything to show choices to the user before that page and then to process them in the InstFiles page using sections. It works perfectly.

Thanks a lot for your help / remark.