Old 12th April 2013, 05:55   #1
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
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.
miraz.zaidi is offline   Reply With Quote
Old 12th April 2013, 06:54   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 12th April 2013, 07:14   #3
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
What control contains the text ? I used resource hacker but couldn't actually move the text position.
miraz.zaidi is offline   Reply With Quote
Old 12th April 2013, 07:16   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 12th April 2013, 07:29   #5
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
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.
miraz.zaidi is offline   Reply With Quote
Old 12th April 2013, 07:51   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 12th April 2013, 10:42   #7
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
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.
miraz.zaidi is offline   Reply With Quote
Old 12th April 2013, 11:36   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I'm working on a small plug-in which will make control resizing easier. It will be ready in an hour.

Stu
Afrow UK is offline   Reply With Quote
Old 12th April 2013, 11:59   #9
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
Wow. Thats great.
miraz.zaidi is offline   Reply With Quote
Old 12th April 2013, 13:36   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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 is offline   Reply With Quote
Old 13th April 2013, 17:07   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 15th April 2013, 06:18   #12
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
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:

Quote:
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?
miraz.zaidi is offline   Reply With Quote
Old 15th April 2013, 10:02   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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:
code:
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
Afrow UK is offline   Reply With Quote
Old 15th April 2013, 12:12   #14
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
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.

code:
FindWindow $R0 `#32770` `` $HWNDPARENT
GetDlgItem $R0 $R0 MUI_WELCOMEPAGE_TEXT
nsResize::Set $R0 0 200 50u 50u

miraz.zaidi is offline   Reply With Quote
Old 15th April 2013, 13:18   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That is just a compile time define for the label text. The handle is stored in $mui.WelcomePage.Text:
code:
nsResize::Set $mui.WelcomePage.Text 0 200u 50u 50u
Stu
Afrow UK is offline   Reply With Quote
Old 15th April 2013, 13:39   #16
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
Well I tried this too earlier..but Nsis is not recognizing it, text size is not changing and this warning is showing up :

Quote:
unknown variable/constant "mui.WelcomePage.Text" detected.
Has it worked for you ?
(Sorry for bugging you this much. )
miraz.zaidi is offline   Reply With Quote
Old 15th April 2013, 14:10   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You must be using MUI1. Switch to MUI2.nsh.

Stu
Afrow UK is offline   Reply With Quote
Old 16th April 2013, 06:32   #18
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
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:

Quote:
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.
miraz.zaidi is offline   Reply With Quote
Old 16th April 2013, 22:06   #19
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Do you have MUI_FUNCTION_DESCRIPTION_BEGIN but with no MUI_PAGE_COMPONENTS?

Stu
Afrow UK is offline   Reply With Quote
Old 18th April 2013, 13:05   #20
miraz.zaidi
Junior Member
 
Join Date: Feb 2013
Posts: 43
Yeah.. removed it and all is working fine now. A big thanks to you for all the help.
miraz.zaidi is offline   Reply With Quote
Old 10th January 2014, 18:35   #21
shadowpoa
Member
 
Join Date: Jun 2011
Posts: 52
Smile Great plugin Afrow

I do know that is an old thread, but information is always useful for someone.

To do this, i've added this piece of code:

PHP Code:
!define /math LVM_GETCOLUMNWIDTH  ${LVM_FIRST} + 29 
PHP Code:
 FindWindow $"#32770" "" $HWNDPARENT
  GetDlgItem 
$$0 1016
  SendMessage 
$${LVM_SETCOLUMNWIDTH0 desiredsizeinpixels 
I´ve used WinSpy to easily get the actual size of listview.

Also it is possible to get the current column size with this define and sendmessage:
PHP Code:
!define /math LVM_SETCOLUMNWIDTH  ${LVM_FIRST} + 30

SendMessage ListViewhWnd 
${LVM_GETCOLUMNWIDTHcolummindex outvar 
shadowpoa is offline   Reply With Quote
Old 11th January 2014, 06:38   #22
stass
Senior Member
 
Join Date: Nov 2012
Posts: 166
shadowpoa
Did as you recommended - but does not work ... Why?
Quote:
; Shifting the default text position in NSIS installer pages
OutFile "test.exe"
!include MUI2.nsh
;!define MUI_WELCOMEPAGE_TEXT "New text goes here New text goes here New text goes here"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW Shift
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

; http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
; http://www.winehq.org/pipermail/wine...er/009527.html
!define LVM_GETCOLUMNWIDTH ${LVM_FIRST} + 29
!define LVM_SETCOLUMNWIDTH ${LVM_FIRST} + 30
;!define /math LVM_SETCOLUMNWIDTH ${LVM_FIRST} + 30

Function Shift
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1202 # ID MUI_WELCOMEPAGE_TEXT

; SendMessage ListViewhWnd ${ LVM_GETCOLUMNWIDTH } colummindex outvar
SendMessage $0 ${LVM_GETCOLUMNWIDTH} 1202 $R0
SendMessage $R0 ${LVM_SETCOLUMNWIDTH} 250 211 ; my size( default 293x211 )
FunctionEnd
stass is offline   Reply With Quote
Old 11th January 2014, 10:07   #23
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
LVM_GETCOLUMNWIDTH/LVM_SETCOLUMNWIDTH is used for LISTVIEW controls only. If you want to resize the welcome page text, use the nsResize plug-in.

Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
default text position, nsis

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump