- NSIS Discussion
- Shifting the default text position in NSIS installer pages
Archive: Shifting the default text position in NSIS installer pages
miraz.zaidi
12th April 2013 06:55 UTC
Shifting the default text position in NSIS installer pages
I am using a background image for my installer pages, I have set all the other controls transparent.
There is a logo in the background image , which is overlapping with text on installer pages like the text on welcome page, license page etc.
So is it possible that I can shift the position of this text from default to the one suitable for me, so that my background logo remains visible? Please Help.
Thanks.
Afrow UK
12th April 2013 07:54 UTC
For all pages except the welcome and finish pages, I would recommend you modify the UI itself using Resource Hacker. The UI is Contrib\Graphics\UIs\modern.exe - copy to your script directory. You can apply it using !define MUI_UI modern_new.exe. You can just delete a load of controls that you are currently hiding. Be careful though... deleting some controls will result in a compile error so check your script still compiles when you do. For those that you cannot delete, I give them a size of 0, 0 and position them outside the dialog.
As for the welcome and finish pages, you must either resize the controls at run time using the System plug-in and SetWindowPos or you could make a copy of the MUI source code and modify that instead. In either case it's quite messy.
Stu
miraz.zaidi
12th April 2013 08:14 UTC
What control contains the text ? I used resource hacker but couldn't actually move the text position.
Afrow UK
12th April 2013 08:16 UTC
You haven't said which text you are trying to resize so my guess is as good as yours. If you modify it in Resource Hacker make sure you click Compile before saving.
Stu
miraz.zaidi
12th April 2013 08:29 UTC
I am trying to reposition text on Welcome page, Install directory page and Finish Page.
And I am compiling and then saving in resource hacker. But couldnt find the right controls I guess.
Afrow UK
12th April 2013 08:51 UTC
As I said the welcome and finish pages need to be repositioned by modifying the Modern UI source code or by moving them at run time using the SetWindowPos API. The welcome and finish pages are not standard dialogs - they are created at run time using the nsDialogs plug-in. The directory page is dialog 103 (the main text control is #1006).
Stu
miraz.zaidi
12th April 2013 11:42 UTC
Ok..Thanks Stu. I was able to reposition the text on $instdir page using resource hacker.
But , I am still confused about welcome/finish page.. Even if I use SetWindowPos API as you suggested, I still need to know the Handle of the control that contains the text, isnt it ? Or am I missing something here.
Afrow UK
12th April 2013 12:36 UTC
I'm working on a small plug-in which will make control resizing easier. It will be ready in an hour.
Stu
miraz.zaidi
12th April 2013 12:59 UTC
Wow. Thats great. :D
Afrow UK
12th April 2013 14:36 UTC
Sorry I ran out of time and I want to make sure it works for RTL languages.
For the welcome/finish page control handles, check Contrib\Modern UI 2\Pages\*. There are variables defined for each control.
Stu
Afrow UK
13th April 2013 18:07 UTC
Finished the plug-in:
http://nsis.sourceforge.net/NsResize_plug-in
You can use the nsResize::Add function to increase the size of controls using the same units as nsDialogs (pixels, dialog units or percent). I've also added an example script which increases the size of the entire NSIS installer and uninstaller UI along with all wizard pages without any hacking of the UI with Resource Hacker.
Stu
miraz.zaidi
15th April 2013 07:18 UTC
Hey Stu.. Many thanks for this plugin.
But I am not able to use it properly.
For example, I am trying to resize the text on Directory page so I am doing this:
nsResize::Set 1006 25 150 460 190
But the text remain unchanged on installer directory page.
Can you pls give me an example for resizing controls?
Afrow UK
15th April 2013 11:02 UTC
It wants a window handle rather than an id. Also I would use dialog units over pixels and I would use Add rather than Set if you just want to make a control bigger.
For example:
FindWindow $R0 `#32770` `` $HWNDPARENT
GetDlgItem $R0 $R0 1006
nsResize::Add $R0 0 0 0 20u
This will make the control 20 dialog units higher.
Stu
miraz.zaidi
15th April 2013 13:12 UTC
Ok. Great. It worked!!! Thanks.
And regarding the text on welcome page I checked Contrib\Modern UI 2\Pages\welcome.nsh as you suggested, the MUI_WELCOMEPAGE_TEXT is defined for text control but when I used it to resize, nothing happened.
FindWindow $R0 `#32770` `` $HWNDPARENT
GetDlgItem $R0 $R0 MUI_WELCOMEPAGE_TEXT
nsResize::Set $R0 0 200 50u 50u
Afrow UK
15th April 2013 14:18 UTC
That is just a compile time define for the label text. The handle is stored in $mui.WelcomePage.Text:
nsResize::Set $mui.WelcomePage.Text 0 200u 50u 50u
Stu
miraz.zaidi
15th April 2013 14:39 UTC
Well I tried this too earlier..but Nsis is not recognizing it, text size is not changing and this warning is showing up :
unknown variable/constant "mui.WelcomePage.Text" detected.
Has it worked for you ?
(Sorry for bugging you this much. )
Afrow UK
15th April 2013 15:10 UTC
You must be using MUI1. Switch to MUI2.nsh.
Stu
miraz.zaidi
16th April 2013 07:32 UTC
You're right. I was using MUI1.nsh. Now I switched to MUI2.nsh , found out that it doesnt support MUI_HWND so modified the code according to MUI2 , and finally it Worked. Thanks a lot Stu.
Similarly it worked for Finish page. (Wow)
But I dont why , there are coming these same warnings, as below:
unknown variable/constant "mui.ComponentsPage.DescriptionText" detected, ignoring (macro:MUI_DESCRIPTION_BEGIN:4)
unknown variable/constant "mui.ComponentsPage.DescriptionText" detected, ignoring (macro:MUI_DESCRIPTION_BEGIN:5)
unknown variable/constant "mui.ComponentsPage.DescriptionText.Info" detected, ignoring (macro:MUI_DESCRIPTION_BEGIN:6)
unknown variable/constant "mui.ComponentsPage.DescriptionText" detected, ignoring (macro:MUI_DESCRIPTION_BEGIN:6)
unknown variable/constant "mui.ComponentsPage.DescriptionText" detected, ignoring (macro:MUI_DESCRIPTION_TEXT:6)
unknown variable/constant "mui.ComponentsPage.DescriptionText" detected, ignoring (macro:MUI_DESCRIPTION_TEXT:7)
unknown variable/constant "mui.ComponentsPage.DescriptionText" detected, ignoring (macro:MUI_DESCRIPTION_TEXT:8)
Though there is no MUI_DESCRIPTION_* in my code.
Afrow UK
16th April 2013 23:06 UTC
Do you have MUI_FUNCTION_DESCRIPTION_BEGIN but with no MUI_PAGE_COMPONENTS?
Stu
miraz.zaidi
18th April 2013 14:05 UTC
Yeah.. removed it and all is working fine now. A big thanks to you for all the help. :)