Archive: Change size of Description Box on components page?


Change size of Description Box on components page?
  Hi,

is it possible to change the size (make it larger) of the Description Box on the components page?

I am actually using MUI_COMPONENTSPAGE_SMALLDESC without the INSTTYPE combo box. So there is some space between the MUI_COMPONENTSPAGE_TEXT_TOP and the start of the components list.

Is it possible to move the components list up and make the Description Box larger?
If so - how to do it?

Thanks,
Gunther


You can always call the appropriate win32 API commands (through the system plugin). But I'm sure there's easier way to do it. Have you tried searching the forums? Modification of the components page has been discussed before.


Use Resource Hacker to modify the UI and save as your own then use it with the MUI_UI define.

Stu


MSG, Afrow UK

thanks for your replies ...!
Though I have read a lot in the forum here, the Wiki, the documentation etc. I do not really understand the methods you suggested - sorry.

@Afrow UK
For several reasons I don't want to use a method which results in additional files. So this one is out.

@MSG
Did I get it right that you mean something like

FindWindow$0 "#32770" "" $HWNDPARENT

GetDlgItem$0 $0 1016
>
If so, what are the IDs of the elements on the components page?

I would like to re-arrange and re-size the
- label next to the components list
- components list
- description box title
- description box

Did I miss anything?

Thanks for further help/ explanation,

Gunther

Open \NSIS\Contrib\Modern UI 2\Pages\Components.nsh file and you will find all IDs.

Why you dont want to use own GUI? You can just copy original GUI (\NSIS\Contrib\UIs), change its design, save as for example MyGUI.exe and include it to your project, using:

!define MUI_UI "My_GUI_Directory\MyGUI.exe"

-Pawel


Pawel,

thanks for your reply.

Originally posted by Pawel
Open \NSIS\Contrib\Modern UI 2\Pages\Components.nsh file and you will find all IDs.
Yes, found them ...

Why you dont want to use own GUI?
I am writing a script file which is hosted in a GIT repository. The nsi file is generated by Cmake. So everbody should be able to compile and generate the Inst file with just have the appropriate version of NSIS installed. So any additional file or needed change is not wanted as well as any platform specific addition (the related program is cross-platform).

You can just copy original GUI (\NSIS\Contrib\UIs), change its design, save as for example MyGUI.exe and include it to your project, using:

!define MUI_UI "My_GUI_Directory\MyGUI.exe"
OK, I gave it a try using Resource Hacker.
So far so good ..., it works.
But there is the problem of the additional file ...!

Would it be possible to do the resizing by script (ie. by using SendMessage) so that there would be no additional file?

If not, would it be possible to copy the new GUI file from the repository to the users ${NSISDIR} by the installer before it is used/ initialized, or does it need to be already in place before the installer is run?

Thanks,
Gunther

Originally posted by Netsurfer24
Would it be possible to do the resizing by script (ie. by using SendMessage) so that there would be no additional file?
Yes, that is what you need the HWND variables for that you got from Components.nsh. You can call win32 commands like GetWindowRect and SetWindowPos using the system plugin.

Hi MSG!

Originally posted by MSG
Yes, that is what you need the HWND variables for that you got from Components.nsh. You can call win32 commands like GetWindowRect and SetWindowPos using the system plugin.
That is exactly what I am looking for. :up:

I already know the IDs for the window (FindWindow) and the several controls (GetDlgItem).

As this is completely new to me, please excuse my question, but how to use these "win32 commands"?
Is it always like "System::Call "User32::xyz"?
And can I use this site http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx as reference for the parameters needed by the different functions?

Thanks,

Gunther

Yes (mostly), and yes, you can.
Let me copypaste some code from a very old installer of mine:


        nxs::getWindow /NOUNLOAD
Pop $1 ;(now contains the HWND of the nxs window)
System::Alloc 16
Pop $2
System::Call "user32::GetWindowRect(i r1, i r2)"
System::Call "*$2(i .r3, i .r4, i, i)"
System::Free $2
IntOp $4 $4 + 20
System::Call 'User32::SetWindowPos(i $1, i $1, i $3, i $4, i 0, i 0, i 5)'
What this does is simply move the nxs window down 20 pixels.

I'll give it a try and report back.
Thanks for now.

Gunther


Tried the following (in different variations) in the Show function of the Components Page:


FindWindow $mui.ComponentsPage "#32770" "" $HWNDPARENT

GetDlgItem $mui
.ComponentsPage.Text $mui.ComponentsPage 1006
GetDlgItem $mui.ComponentsPage.InstTypesText $mui.ComponentsPage 1021
GetDlgItem $mui.ComponentsPage.ComponentsText $mui.ComponentsPage 1022
GetDlgItem $mui.ComponentsPage.InstTypes $mui.ComponentsPage 1017
GetDlgItem $mui.ComponentsPage.Components $mui.ComponentsPage 1032
GetDlgItem $mui.ComponentsPage.DescriptionTitle $mui.ComponentsPage 1042
GetDlgItem $mui.ComponentsPage.DescriptionText $mui.ComponentsPage 1043
GetDlgItem $mui.ComponentsPage.SpaceRequired $mui.ComponentsPage 1023
System::Call "User32::SetWindowPos($mui.ComponentsPage.InstTypes, 1, 10, 50, 180, 50, 0)" ; 1017
System::Call "User32::SetWindowPos($mui.ComponentsPage.InstTypesText, 1, 10, 30, 0, 0, 0)" ; 1021
System::Call "User32::SetWindowPos($mui.ComponentsPage.SpaceRequired, 1, 20, 115, 0, 0, 0)" ; 1023
System::Call "User32::SetWindowPos($mui.ComponentsPage.DescriptionTitle, 0, 198, 40, 100, 100, 0)" ; 1042
System::Call "User32::SetWindowPos($mui.ComponentsPage.DescriptionText, 0, 203, 50, 90, 85, 0)" ; 1043
System::Call "User32::SetWindowPos($mui.ComponentsPage.ComponentsText, 0, 0, 25, 300, 15, 0)" ; 1022
System::Call "User32::SetWindowPos($mui.ComponentsPage.Components, 0, 0, 40, 195, 100, 0)" ; 1032
>
Has no effect ...!? :(

Although it throws no error it doesn't work at all. No single little difference on the modern smalldesc components page.

Does anybody see what's wrong?

Is it generally possible to change the control sizes and positions (for non-custom pages) of Modern UI pages by using SetWindowPos?

Thanks,

Gunther

You need an 'i' for each parameter like MSG has got in his example.

Stu


Hi Stu!

Originally posted by Afrow UK
You need an 'i' for each parameter like MSG has got in his example.
Thanks a lot - that did the trick! :)
But there are still other problems ... :rolleyes:!

One is that the width and height values seems not to be recognized. Although I have taken the values from Resource Hacker (where they displayed OK), the result in the installer is "wrong".

Second problem deals with the Z index. Now ie. the InstType combo box (which needs to exist - but as I am not using it I don't want it to show up) shows up again.

Can you tell me what I am still doing wrong and what values I have to use for the last parameter if I want a control/ window to be
  1. not shown/ displayed - pushed to the back - behind another control
  2. displayed on top of other controls - in front

Thanks,

Gunther

PS: I looked at http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx

In Resource Hacker you're using dialog units.
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

If you don't want the InstType combo box, hide it with ShowWindow and ${SW_HIDE}.

Stu


Stu ...

Originally posted by Afrow UK
In Resource Hacker you're using dialog units.
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
Ah - so the System Call uses pixels instead of dialog units, right?
Sorry, but I did not understand how to "convert" my dialog unit values to the needed one. Can you help me out again, please? :)

Or is it possible to use the MapDialogRect function?
If so, how?

If you don't want the InstType combo box, hide it with ShowWindow and ${SW_HIDE}.
Why doing it the easy way if there is also a complicated one ... :rolleyes: - you are right of course.

Thanks,

Gunther

This shows how to use GetDialogBaseUnits() (search for that in the page):
http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx

You get a DWORD from it which you need to split in two (X and Y units) using the LOWORD and HIWORD macros respectively (you'll need to re-write those in NSIS using IntOp I'm afraid).

For X dialog units you multiply LOWORD(dwUnits) by your X pixels value and divide the result by 4.
For Y dialog units you multiply HIWORD(dwUnits) by your Y pixels value and divide the result by 8.

I suppose you could request that these be added as a macro function or plugin call in nsDialogs.

Stu


Originally posted by Netsurfer24
I did not understand how to "convert" my dialog unit values to the needed one.
If you first GetWindowRect, you'll have the original position in pixels. You can use that as a base.

Originally posted by MSG
If you first GetWindowRect, you'll have the original position in pixels. You can use that as a base.
That is an option but you'll still be adding to them in pixel units. You then cannot predict how the dialog will appear for people running different DPI or fonts.

Stu

Stu

Thanks for your reply, but now it is getting a bit too complicated for me - I am afraid (it is the first time for me getting in contact with NSIS). Until now I found an answer to all my questions in the docu or here in the forum.

Originally posted by Afrow UK
This shows how to use GetDialogBaseUnits() (search for that in the page):
http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx
I found the section on the page but that still gave me no clue how to use this along with NSIS? :cry:
You get a DWORD from it which you need to split in two (X and Y units) using the LOWORD and HIWORD macros respectively (you'll need to re-write those in NSIS using IntOp I'm afraid).
And again the same problem of not knowing how to use them.
After some searching I found out that the mentioned macros belong to the Include\Win\WinDef.nsh - correct?

For X dialog units you multiply LOWORD(dwUnits) by your X pixels value and divide the result by 4.
For Y dialog units you multiply HIWORD(dwUnits) by your Y pixels value and divide the result by 8.
I think if I could make it till here this shouldn't be a problem then. But first of all I need to come to this point ... :(

I suppose you could request that these be added as a macro function or plugin call in nsDialogs.
If I finally succeeded I will do so. ;)

Stu, would you be so kind and post an example code line for the above, please?
I fear otherwise I get stuck at this point here - and seems to be so close to the finish line ... :)

Thanks a lot,

Gunther

Originally posted by MSG
If you first GetWindowRect, you'll have the original position in pixels. You can use that as a base.
Please be so kind and post an example code line - that makes it a lot easier for me to understand it.

@Stu + MSG:
If I understood it right I only once need the calculation factor depending on the users font and DPI values, right?

So it might be an alternative to Stu's suggestion to use the GetWindowRect function and then the MapDialogRect Function (http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx)?

But I still have not understood how to use these functions and I cannot find any hints, neither by Google nor in the forum.

So your (further) help is very much appreciated!

Thanks,

Gunther

Good news! :up:

I found a (IMHO quite simple) solution to get the X and Y Base Units.
Starting from http://support.microsoft.com/kb/145994/en-us?fr=1 Method 2 I now use the following code:


FindWindow $hndl "#32770" "" $HWNDPARENT

System
::Call "*(i 0, i 0, i 4, i 8) i .r1"
>System::Call "User32::MapDialogRect(i $hndl, i r1) i .r2"
>System::Call "*$1(i .r2, i.r3, i.r4, i.r5)"
>System::Free $1
>
Then the Base Unit X factor is available in $4 and the Y one in $5 - that's it. :D

Now I am looking for an easy way to calculate the needed pixel values from the dialog units ones? Thought of one or two macros but being not quite sure how to get the return values inserted in the User32::SetWindowPos function call?

Any hints, tips or suggestions?

Thanks,
Gunther