Is it harmless to use MUI_PAGE_WELCOME several times? - nsis

I need to show some pages that contain text at the end of my installation. As far as I can see, there is no template for just showing a text page.
Since constructing own page templates looks a bit complicated to me I thought I could just abuse MUI_PAGE_WELCOME for this purpose and use it multiple times, i.e. like this:
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_WELCOMEPAGE_TITLE "Text page 1"
!define MUI_WELCOMEPAGE_TEXT "An important information..."
!insertmacro MUI_PAGE_WELCOME
!define MUI_WELCOMEPAGE_TITLE "Text page 2"
!define MUI_WELCOMEPAGE_TEXT "Another important information..."
!insertmacro MUI_PAGE_WELCOME
!define MUI_WELCOMEPAGE_TITLE "Text page 3"
!define MUI_WELCOMEPAGE_TEXT "And a final important information..."
!insertmacro MUI_PAGE_WELCOME
This seems to work fine. Still, as someone who is rather new to NSIS I'd like to ask the question whether what I'm doing here is allowed and harmless or whether it has any implications.

You usually use the MUI finish page (MUI_PAGE_FINISH) at the end but you can show the welcome page again if you really want to.
You can show any page as many times as you want. You can also create custom pages with the nsDialogs plug-in.
The MUI documentation tells you which defines apply to all pages of a certain type and which defines only applies to the next page of that type.

Related

Adjust component size for MUI2

Actually I´m trying to change my component size of the MUI2 Components of the following pages:
!insertmacro MUI_PAGE_LICENSE
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
I did add also the Customfunction to change the size of each window, with the nsResize Plug-In. Now i have the problem that the Components are missplaced and to small, in width and height.
I searched for it and did find some ideas for my question. But i do not want to use the resourcehacker to create the UI new, for several personal reasons. The i saw that i can use the System Plug-In to make the adjustments, but it´s overhelming me with the information Source.
Then I tried to execute it my self and failed.
My actual Solution is:
Function .myGuiInt
System::Call "user32::GetClientRect(i #32770 , i r1)"
System::Call "user32::SetWindowPos(i 1000, i, i, i 15000, i, i)"
....
FunctionEnd
I tried to change the size of the textbox where i set the license.
But i got no effect, how can i make this calls that i can effect the UI?
The easy solution for the components page is to !define MUI_COMPONENTSPAGE_SMALLDESC or MUI_COMPONENTSPAGE_NODESC, this will make the components list larger.
If this is not large enough then the absolute best solution is to create your own UI. You will have to use Resource Hacker or some other .EXE editor to do this but it is a one time operation, you do not have to redistribute the editor, just the produced UI file along with your .NSI if other people also need to compile your installer. Take ...NSIS\Contrib\UIs\modern.exe and edit it to suit your needs and then apply it with MUI_UI (or ChangeUI for classic installers).
The advantage of this is that you will be working with dialog units, not pixels and there are also no programming skills required.
The final option is to do it at run time. This means that you will be working in pixels most of the time so you should not really hardcode any sizes. To use the System plug-in you have to be familiar with Win32 programming. Knowing C/C++ or some other low-level programming language also helps.
!include MUI2.nsh
!insertmacro MUI_PAGE_WELCOME
!define MUI_COMPONENTSPAGE_NODESC
!define MUI_PAGE_CUSTOMFUNCTION_SHOW fullsize_tweak_components_page
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!define /ifndef SWP_NOZORDER 4
!define /ifndef SWP_NOACTIVATE 0x10
Function fullsize_tweak_components_page
System::Call 'USER32::GetClientRect(p $mui.ComponentsPage, # r0)' ; Get the size of the inner dialog
System::Call '*$0(i,i,i.r3,i.r4)' ; Extract the right and bottom members from RECT
System::Call 'USER32::SetWindowPos(p $mui.ComponentsPage.Components, p 0, i 0, i 0, i $3, i $4, i ${SWP_NOZORDER}|${SWP_NOACTIVATE})' ; Resize the components list
FunctionEnd

NSIS invisible header text

Header text in license window is invisible. After I click I Agree button and Back button text appears.
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "MY\IMAGE.bmp"
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
I use WelcomeFinish.nsi
How can I solve this?
Had to use Resource Hacker to change the order of elements on exe template.

How to resize the list box of sections in NSIS MUI_PAGE_INSTFILES

I want to change the basic style of the Install Files page of NSIS.
Currently it shows a list box of sections and i want that the width of this listbox will change automatically according to it's content.
And maybe to remove the other empty listbox as shown in the image below.
thanks.
I'm using MUI2 and there is the code:
page components
!define MUI_PAGE_CUSTOMFUNCTION_SHOW InstFilesShow
!insertmacro MUI_PAGE_INSTFILES
http://i.stack.imgur.com/T3VD5.png
it happens because of this use
page components
i changed to this and added the
**!define MUI_COMPONENTSPAGE_NODESC**
!define MUI_COMPONENTSPAGE
!insertmacro MUI_PAGE_COMPONENTS
it works :)

Back Button gets hidden in choose StartMenu Page for NSIS - Ultra Modern UI

I have pages lined up like this:
!define MUI_PAGE_CUSTOMFUNCTION_PRE PageCheck ;Hiding Welcome Page if needed
!insertmacro MUI_PAGE_WELCOME
Page custom ChooseDirAndOverWrite ChooseDirAndOverWriteLeave
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER $StartMenuDefault
!insertmacro UMUI_PAGE_ALTERNATIVESTARTMENU "Application" $StartMenuFolder
!insertmacro UMUI_PAGE_CONFIRM
When I reach the screen "choose Startmenu folder", which is !insertmacro UMUI_PAGE_ALTERNATIVESTARTMENU "Application" $StartMenuFolder, the Back button is visible for a split second and then gets hidden, only on first time.
On clicking next, then coming back, the Button is enabled there onwards.
What may be causing this behaviour, and where can I get it corrected ?
Also, I read that Ultra Modern UI StartMenu Page does not have a Show Function. Is there a work around for it ?

How to change Progress bar length in MUI instfiles page and arrange button position?

I'm using the MUI Page INSTFILES in my Installer and I want to change the length of the Progress bar and the Position of the "Show Details" Button in it.
Is this possible still using the MUI Page or do I have to make my own custom Page with nsDialogs?
You can use Resource Hacker to edit ${NSISDIR}\Contrib\UIs\modern.exe and then use this new UI resource:
!define MUI_UI myNewUI.exe
!include MUI2.nsh
...
The other alternative is to call SetWindowPos or MoveWindow with the system plugin at run-time but this is a bit harder to do...

Resources