- NSIS Discussion
- Controling hacked dialog buttons?
Archive: Controling hacked dialog buttons?
Alasdair
19th May 2005 00:08 UTC
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!
Anders
19th May 2005 04:48 UTC
1 - Call ShowWindow in the show func for each page
2 - You will have to write a plugin that subclasses the main window
Alasdair
19th May 2005 11:33 UTC
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.
Aaron's rod
19th May 2005 12:19 UTC
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.
Aaron's rod
19th May 2005 16:49 UTC
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.
Alasdair
19th May 2005 17:30 UTC
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.
Afrow UK
19th May 2005 18:37 UTC
!define MUI_PAGE_CUSTOMFUNCTION_SHOW showFunc
!insertmacro MUI_PAGE_DIRECTORY
-Stu
deguix
19th May 2005 20:20 UTC
UltraModern UI? Never heard of this. Do you mean Experience UI which has blue pages?
Alasdair
19th May 2005 22:14 UTC
No, UltraModern UI. It looks very nice:
http://guerin45.free.fr/UltraModernUI/
Thanks Afrow UK!
Alasdair
19th May 2005 22:43 UTC
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.
deguix
20th May 2005 04:22 UTC
Did someone publish this UI here when it was released? I sincerely don't remember anything about this.
Afrow UK
20th May 2005 11:42 UTC
Says it's made by SuperPat in docs.
-Stu
kichik
20th May 2005 12:06 UTC
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.
Alasdair
20th May 2005 14:25 UTC
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!
Afrow UK
20th May 2005 15:16 UTC
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
Alasdair
20th May 2005 17:28 UTC
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.
wanderer
20th May 2005 17:47 UTC
looks like this one does something like that process... http://forums.winamp.com/showthread....85#post1638685
Alasdair
20th May 2005 22:36 UTC
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!
Afrow UK
20th May 2005 23:19 UTC
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