Archive: Controling hacked dialog buttons?


Controling hacked dialog buttons?
Hello,

I needed an extra button at the bottom of the setup screen (along with next, back, cancel) and so I used the resource hacker to add this button into the UI executable (is there a better way?) I gave the button ID 8888, which I assume is not being used.

This button now appears nicely on all pages of the setup program, but I need to do the following, and don't know how:

1. I only want the button to appear on certain pages of the setup program. Is there a way to make it invisible on the other pages?

2. I want the button to perform certain actions when pressed, and slightly different actions for different pages that it appears on. How to I go about implementing this?

Please help me out if you can. Thanks!


1 - Call ShowWindow in the show func for each page
2 - You will have to write a plugin that subclasses the main window


Thanks, but could you please be a bit more specific? I'm new to NSIS and haven't done enough programming in regards to dialogs to know how they work.


I don't think it's possible to do what you are trying without using InstallOptions plugin. You need it at lest to get the button actions.

However I am using "hacked" checkbox in my Self-Extractor thingy so that way I don't have to use InstallOptions plugin.

Use this code to hide and show the button.

!include WinMessages.nsh

Page directory "" page_hide
Page instfiles "" page_show

Function page_function
Push $R0
Push $R1

FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 8888
ShowWindow $R1 ${SW_HIDE}

Pop $R1
Pop $R0
FunctionEnd

Function page_show
...
just as the page_hide but use ${SW_SHOW}



I am using this code to get the checkbox status.
Page directory "" "" get_checkbs

Function get_checkbs
Push $R0
Push $R1

FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1080
SendMessage $R1 0x00F0 0 0 $checkb_val

Pop $R1
Pop $R0
FunctionEnd

I am quite sure that this don't help you thou.
Because you can only use it to check control status between pages.

Apparently that hide show script don't work if your button is in dialog 105, then you have to use function like this.



!include WinMessages.nsh

Page directory "" page_hide

Function page_hide
Push $R0

GetDlgItem $R0 $HWNDPARENT 8888
ShowWindow $R0 ${SW_HIDE}

Pop $R0
FunctionEnd
Those previous functions only effect in current page's conrols.

Okay, I've got the button displaying and hiding on the correct pages. But I'm using UltraModern UI (which is just an extension to Modern UI) and when I set pages using:
Page directory "" decline_hide
...the background of the page is grey instead of blue.

I tried the following but it gives an error:
Page MUI_PAGE_DIRECTORY "" decline_hide

Is there a different way of doing it on Modern/Ultramodern UI?

Thanks.


!define MUI_PAGE_CUSTOMFUNCTION_SHOW showFunc
!insertmacro MUI_PAGE_DIRECTORY

-Stu


UltraModern UI? Never heard of this. Do you mean Experience UI which has blue pages?


No, UltraModern UI. It looks very nice:
http://guerin45.free.fr/UltraModernUI/

Thanks Afrow UK!


Okay, I've got the buttons appearing on the right pages. Thanks with that!

I'm still stuck as to how to make the button do stuff when it's clicked. I want it to be able to do one of the following on different pages of the setup program:
1. Display a message box.
2. Set a variable and go to the next page.


Did someone publish this UI here when it was released? I sincerely don't remember anything about this.


Says it's made by SuperPat in docs.

-Stu


Originally posted by deguix
Did someone publish this UI here when it was released? I sincerely don't remember anything about this.
It was pusblished in the Winamp FR forums.

So does anyone know the answer to this:

--->>
Okay, I've got the buttons appearing on the right pages. Thanks with that!

I'm still stuck as to how to make the button do stuff when it's clicked. I want it to be able to do one of the following on different pages of the setup program:
1. Display a message box.
2. Set a variable and go to the next page.
<<---

Help me out if you can please. This is very important to me an I really have no idea!


As Anders has already pointed out you have to write a plugin to do that. You have to assign a button to actually do something. This isn't possible with NSIS code on its own.

-Stu


Yeah, but I didn't really understand what he said. I'll break it down:

"You will have to write" <- Understand this bit.
"a plugin" <- What kind of plugin? A DLL?
"that" <- Okay with this bit.
"subclasses" <- How do you mean? Like working with the HWND or something?
"the main window" <- This bit's fine.


looks like this one does something like that process... http://forums.winamp.com/showthread....85#post1638685


Ahhhh, I need lots of this kind of thing and it seems very complicated. It looks like NSIS can't be used to make my complicated setup programs, which is a pity because I thought it was looking good.

I know you people are all NSIS fans, but are there any other good scripted installer creators (free or commercial) that allow more flexibility in terms of UI? (And not Inno Setup because I just left that as it's not powerful enough.)

And thank you for all your help!


I don't think so.
And trust me, NSIS is extremely flexible...
http://hmd.hostileintent.org/mapupdater
Software for updating computer games written in NSIS.

-Stu