Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 10th November 2002, 23:27   #1
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
Question adjusting height

Is there a way to adjust the height of the install dialog? I looked through the documentation for "width" and "dimension" and searched the board for the words also, but it doesn't seem anyone has needed this before. I just want to make my branded picture fit, I am putting it on the left but I want to use a picture that is taller than the installer.

Anyone know how I might do this?
amanda_like_it is offline   Reply With Quote
Old 11th November 2002, 03:57   #2
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
The best method is to use a custom UI. There are several examples located in Contrib\UIs of the NSIS folder. You can edit the existing ones with a program like "Resource Hacker", or compile your own. Inside your script you simply set the ChangeUI attribute to the location of your new UI and the compiler will do the rest. For example, the following will set your dialog to use the new modern UI dialog.

Name "test"
OutFile "test.exe"
ChangeUI all "${NSISDIR}\Contrib\UIs\modern.exe"

Section ""
SectionEnd
dselkirk is offline   Reply With Quote
Old 11th November 2002, 22:33   #3
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
Thanks for the reply.

I've since played with the ModernUI and tried adding a branding image but it seems to ignore me completely. Is this something that will be fixed with the Modern UI? If not, is there some tutorial on how to add an image to the modern ui? I could see using resource hacker to make space but I don't know how I'd go about loading something into that spot through the scripting language.
amanda_like_it is offline   Reply With Quote
Old 12th November 2002, 01:22   #4
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
theres a couple ways you can do it. first it comes down to what type of branding image you want to add. NSIS has a souple functions which will allow you to add an image to the inner dialog. Use the AddBrandingImage and the SetBrandingImage functions. If this doesn't do what you need then we can go to the next step which is using resource hacker.
dselkirk is offline   Reply With Quote
Old 13th November 2002, 01:30   #5
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
Well I found out that if you want to add a branding image to the MODERN_UI using all those fancy macros you have to put it after the !insertmacro MUI_SYSTEM.

This makes space for the image but I am unable to find a function where I can load it from.

By adding another page I was able to get a function to load the image:
Page directory dirImage

But there are two problems with this. First of all I don't want to add the Image after I've gone through all the other pages the MODERN_UI macros have created. Secondly, the image appeared too low and off to the right, clearly not lined up with the borders of the dialog as it should be. I'm pretty sure this last one is a bug, but if I find a better function to load the branding image from perhaps this problem will go away.
amanda_like_it is offline   Reply With Quote
Old 13th November 2002, 02:53   #6
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
This is what I do for my installer. I have a full screen graphic so I have to add an additional control to the outer dialog. I modify dialog 105 in the modern.exe UI file (I user resource hacker for this). I add the following line right below the "{" symbol.

CONTROL "",1001,STATIC,SS_BITMAP|WS_CHILD|WS_VISIBLE|WS_GROUP,0,0,0,0

I then recompile the page and save the exe. In my code I add the following.

Function .onGUIInit
GetTempFileName $R0
File "/oname=$R0" "background.bmp"
SetBrandingImage /IMGID=1001 "$R0"
Delete $R0
FunctionEnd

This will load the graphic into the control. You might have to play around with the ording in the modern.exe but that's basically it.

Hope this helps.
dselkirk is offline   Reply With Quote
Old 13th November 2002, 03:47   #7
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
This almost works but I get the error:
Function: ".onGUIInit"
Error: Function named ".onGUIInit" already exists.
Error in script "eMule.nsi" on line 57 -- aborting creation process

Is this already defined by the MODERN_UI macro?

I tried putting that code in the .onInit function but while it compiled it did nothing.
amanda_like_it is offline   Reply With Quote
Old 13th November 2002, 12:24   #8
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
MUI does have the GUIInit already used but we should be able to get around it. In your script you should have the following line.

!insertmacro MUI_SYSTEM

replace it with the following.

!insertmacro MUI_INTERFACE
!insertmacro MUI_FUNCTIONS_PAGES
Function .onGUIInit
GetTempFileName $R0
File "/oname=$R0" "background.bmp"
SetBrandingImage /IMGID=1001 "$R0"
Delete $R0
!insertmacro MUI_GUIINIT
FunctionEnd
!insertmacro MUI_FUNCTIONS_ABORTWARNING
!insertmacro MUI_UNBASIC

give it a try
dselkirk is offline   Reply With Quote
Old 13th November 2002, 12:40   #9
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
An easier way of using a customized GUIInit function will be added to the next version of the Modern UI.
Joost Verburg is offline   Reply With Quote
Old 13th November 2002, 20:20   #10
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
Ah-ha, thanks dselkirk that did the trick. I'm so close... however I still have a problem getting the image in the right spot/size.

If I use "AddBrandingImage left 164" it will place the branding image down and to the right (and it takes a little more space than I told it to), instead of in the top left corner. Is there a way to tell the image to be at 0,0 after adding the branding image?

If I add it using reshacker I don't know how much space I'd need since 164 units is not the same as 164 pixels... and don't these units change with system font sizes?
amanda_like_it is offline   Reply With Quote
Old 13th November 2002, 20:58   #11
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
The addbrandingimage function adds the image to the inner dialog. the inner dialog is that grey square you see if you edit dialog 105 of the modern.exe. Thats why I add the bitmap control to the ui using resource hacker, it allows me to place the graphic where I want. Also, in resource hacker 164 translates to 110. This shouldn't matter though. The graphic should automatically resize. Why don't you describe how you want it to look and then we can go form there.
dselkirk is offline   Reply With Quote
Old 13th November 2002, 21:08   #12
shantanu_gadgil
Member
 
Join Date: Aug 2002
Location: Pune, India
Posts: 72
Yet another UI "modern3". Hope it helps

This is a modified version of the basic "modern2.exe" UI. You can load it in ResourceHacker and see the location of the image. This is a rough cut

- Shantanu
shantanu_gadgil is offline   Reply With Quote
Old 13th November 2002, 21:10   #13
shantanu_gadgil
Member
 
Join Date: Aug 2002
Location: Pune, India
Posts: 72
sorry, forgot to attach the file

here is the file

- Shantanu
Attached Files
File Type: zip modern3.zip (1.9 KB, 101 views)
shantanu_gadgil is offline   Reply With Quote
Old 14th November 2002, 08:49   #14
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
Hey dselkirk, thanks for the clarification on the AddBrandingImage issue. I still think it would be nice to be able to add a branding image with some sort of automatic macro into the MODERN_UI, however resource hacker worked fine.

I think this is the last problem, when I run the uninstaller it doesn't seem to call .onGUIInit so the branding image doesn't get set. Again, I'd say this is a bug but perhaps it's just ignorance on my behalf. Do you have a clever way of working around this too?

@shantanu_gadgil, thanks for the new layout but I got what I needed as far as layout goes.
amanda_like_it is offline   Reply With Quote
Old 14th November 2002, 10:23   #15
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
The uninstaller uses un.onGUIInit, but you should also insert some macro's manually because the Modern UI basic macro inserts un.onGUIInit.
Joost Verburg is offline   Reply With Quote
Old 14th November 2002, 17:14   #16
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
Well this causes a new problem, the branding image takes up 2x the space now. Is there someway to fix this? It won't let me mix "un." function calls with regular "." functions so I can't see a way around this.
amanda_like_it is offline   Reply With Quote
Old 14th November 2002, 17:25   #17
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
...or perhaps there is a way to use another gui, like say modern.exe, for the uninstaller so I don't have that big space there?

I tried ChangeUI with IDD_UNINST but that only changes the inner dialog.

Last edited by amanda_like_it; 14th November 2002 at 17:49.
amanda_like_it is offline   Reply With Quote
Old 14th November 2002, 17:52   #18
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
There seems to be 2 issues here. I'm not sure whats happening with the branding image size. It almost sounds like 2 images are being added. As for mixing the functions, the only way to do this is to use macros. To do this simply add the following code before any of the !insertmacro I showed you in the previous post.

!macro MY_GUIINIT
GetTempFileName $R0
File "/oname=$R0" "background.bmp"
SetBrandingImage /IMGID=1001 "$R0"
Delete $R0
!insertmacro MUI_GUIINIT
!macroend

Now replace all the code inside the .onGUIInit and un.onGUIInit functions with the following.

!insertmacro MY_GUIINIT

This will insert the same code in both functions.
dselkirk is offline   Reply With Quote
Old 14th November 2002, 22:43   #19
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
Exclamation

I was unclear.

The problem is the image is twice in the installer executable! The installer has two copys of same image compressed seperatly. I add branding image and I gain 100k to installer, then I add branding image to un.onGUIInit and now installer gains 200k!
amanda_like_it is offline   Reply With Quote
Old 14th November 2002, 23:07   #20
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
Ahh. Basically the reason is that the uninstall is a seperate executable that is compiled at the same time as your installer. That is why nsis is so seperated in the script. Why there's "." and "un.". The only thing you can do is either make a silent uninstall (ie. no graphic need then) or optimize your graphic (index the color). Wish I had a better answer for you. Sorry
dselkirk is offline   Reply With Quote
Old 15th November 2002, 01:11   #21
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
well if you say they are seperate executables, isn't there a way for me to change which UI it uses for the uninstaller? I'd be happy if it just used the modern.exe ui...
amanda_like_it is offline   Reply With Quote
Old 15th November 2002, 09:35   #22
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
They are not separate executables, just separate data blocks.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 15th November 2002, 12:44   #23
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
is it possible to have a common data block? This can be for graphics and functions which are common to both install and uninstall?
dselkirk is offline   Reply With Quote
Old 15th November 2002, 12:45   #24
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
I'll check.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 15th November 2002, 12:51   #25
dselkirk
Senior Member
 
Join Date: Aug 2002
Posts: 118
cool, thx
dselkirk is offline   Reply With Quote
Old 16th November 2002, 10:48   #26
amanda_like_it
Junior Member
 
Join Date: Nov 2002
Posts: 15
Common data block? I'd be very much interested in this, would be a useful feature.
amanda_like_it is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

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