Archive: ioSpecial.ini - a button vanishes and appears on mouse hover


ioSpecial.ini - a button vanishes and appears on mouse hover
Hi all!
I've got a problem to work one thing in NSIS. I searched through the forum archive, but didn't find a solution.
I try to tweak the uninstall welcome page this way:

!define MUI_UNWELCOMEFINISHPAGE_INI "MyIoSpecial.ini"
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.MyPagePre
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.MyPageShow
!insertmacro MUI_UNPAGE_WELCOME

And put proper tweaks in MyIoSpecial.ini (it differs from standard ioSpecial.ini with the section [Field 4] and number of fields):
[Settings]
Rect=1044
NumFields=4

[Field 1]
Type=bitmap
Left=0
Right=109
Top=0
Bottom=193
Flags=RESIZETOFIT

[Field 2]
Type=Label
Left=120
Right=315
Top=10
Bottom=59

[Field 3]
Type=Label
Left=120
Right=315
Top=67
Bottom=132

[Field 4]
Type=Button
Left=120
Top=148
Right=194
Bottom=163
Text=Button1

Then I implement the declared functions:
Function un.MyPagePre
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "NumFields" "4"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 4" "State" "$INSTDIR\Action.exe"
FunctionEnd

Function un.MyPageShow
FunctionEnd


And I get a strange behaviour (similiar to the one described in here). Initially no button is displayed, but when I hover the mouse over the space where the button is supposed to be it appears, but when I change the focus to any other window and then back to my installer, the button vanishes again, but will appear after another hover. What might be the problem?
I'm using NSIS 2.21.

Have you got any ideas? 'Cause I'm stuck. Google doesn't say anything.
Thanks,
Wojtek

It's covered up by a Label control which needs to be reduced in size.

-Stu


It's covered up by a Label control which needs to be reduced in size.
Ok, it's strange. Maybe I don't understand the NSIS correctly. I viewed the generated ioSpecial.ini in $PLUGINSDIR and you were right - it tweaked the labels settings and the label in fact covered the button. But why? Now I'm just asking out of curiosity.

I fixed it by forcing the size of the label:
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Field 3" "Bottom" "132"

I forgot to thank you Stu, so: Thank you :)
Wojtek

I've got another quick question regarding a button: Is it possible to set State argument in ini to open an exe with a parameter? I know it uses ShellExecute. So how to pass parameters to the executable? I couldn't find any info in InstallOptions readme.


Wojtek


The MUI automatically adjusts ioSpecial.ini for specific settings. Take $PLUGINSDIR\ioSpecial.ini when running and use that as a reference instead of Contrib\Modern UI\ioSpecial.ini.

As for the button, you can use the NOTIFY flag and then execute whichever code you wish, including Exec or ExecWait.


As for the button, you can use the NOTIFY flag and then execute whichever code you wish, including Exec or ExecWait.
Hi!
I know about this feature, but I didn't know how to use it when redefining uninstall welcome page. Now I realized I should put the callback code for NOTIFY flag in Leave function defined like this:
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.MyPageLeave

Function un.MyPageLeave
ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Settings" "State"
StrCmp $0 4 buttonAtField4Clicked end
buttonAtField4Clicked:
Exec "$INSTDIR\someexe.exe 'someparams'"
Abort ;needed to properly return to the page and not to continue to next page
end:
FunctionEnd

I provided the answer, because maybe somebody else will use it.

It works great! Thanks!
Wojtek