Ivanov
14th January 2009 10:20 UTC
MUI2 finish page two lines for run
I'm moving to MUI2 and have a problem with the finish page.
I used the run checkbox to start my function and the text for the checkbox was to long for one line so I used that code to make it two lines high.
But it does not work any more since MUI2 is based on nsDialog. So how could I do the same for MUI2?
Function fin_pre
;two lines for the install checkbox
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 4" "Bottom" "120"
FunctionEnd
MSG
14th January 2009 10:43 UTC
To modify MUI2's default pages, check the files in your NSIS\Contrib\Modern UI 2\Pages directory and look for variables such as mui.FinishPage.Run . They contain the HWND of the dialog (visual object). Use that HWND to change the dialog's properties (in the page SHOW function, if I recall correctly).
Ivanov
14th January 2009 15:24 UTC
thanks MSG for the right direction,
so now I have the handle of the checkbox and can check/uncheck it using SendMessage.
I also found the right function to resize it, but first I want to get the position of the checkbox inside the window. System plugin is a powerfull tool, but I cannot get the result I wish, so I hope someone can help.
here is the code wich should get the coordinates of the checkbox (RECT), but all values I get back are 0.
System::Alloc 16
Pop $1
System::Call "User32::GetClientRect (i $mui.FinishPage.Run,i r1)"
;System::Call "User32::GetWindowRect (i $HWNDPARENT, i r1)"
System::Call "*$1(i .r2, i .r3, i .r4, i .r5)"
System::Free $1
MessageBox MB_OK|MB_ICONEXCLAMATION "left: $2 $\r$\n top: $3 $\r$\n right: $4 $\r$\n bottom: $5"
Ivanov
14th January 2009 15:33 UTC
All right, the definition of the called function was wrong
this works:
System::Call "User32::GetClientRect(i, i) i ($mui.FinishPage.Run, r1) .r9"
Ivanov
14th January 2009 16:10 UTC
Here is the complete code for resizing the checkbox, can be also used to resize any control.
; allocate memory for RECT structure
System::Alloc 16
Pop $1
; Get the current height of the checkbox, save it in $2 and make it double size
; save the width too
System::Call "User32::GetClientRect(i, i) i ($mui.FinishPage.Run, r1) .r9"
System::Call "*$1(i , i , i .r3, i .r2)"
IntOp $2 $2 * 2
; get the position of the window and the position of the checkbox to
; calculate the relative position (top,left corner) of the checkbox inside the window
System::Call "User32::GetWindowRect(i, i) i ($HWNDPARENT, r1) .r9"
System::Call "*$1(i .r6, i .r7, i, i)"
System::Call "User32::GetWindowRect(i, i) i ($mui.FinishPage.Run, r1) .r9"
System::Call "*$1(i .r4, i.r5, i, i)"
System::Free $1
; save x in $4 and y in $5
IntOp $4 $4 - $6
IntOp $5 $5 - $7
; resize the control using MoveWindow call and force redraw
System::Call "User32::MoveWindow(i, i, i, i, i, i) b ($mui.FinishPage.Run, $4, $5, $3, $2, 1)"