Archive: need urgent help, is it a bug?


need urgent help, is it a bug?
As you see, the default checked radiobutton is "test2", why it will change to "test1" if I press any of taskbar button.

This issue only occured when the page was shown and I press the taskbar button before any buttons was pressed on the page. So what's the cause? Someone helps?


test.nsi


!include 'MUI.nsh'
!include 'WinMessages.nsh'
!include 'LogicLib.nsh'

ReserveFile 'cutmpage.ini'
Page custom create check
OutFile test.exe
Var DLGITEM

!macro SendCMD INI Field hwnd CODE wparam lparam
!insertmacro MUI_INSTALLOPTIONS_READ $DLGITEM '${INI}' '${Field}' '${hwnd}'
${Select} ${CODE}
${Case} 'EnableWin'
EnableWindow $DLGITEM ${wparam}
${Case} 'ShowWin'
${IfThen} ${wparam} == 0 ${|} ShowWindow $DLGITEM ${SW_HIDE} ${|}
${IfThen} ${wparam} == 1 ${|} ShowWindow $DLGITEM ${SW_SHOW} ${|}
${CaseElse}
SendMessage $DLGITEM ${CODE} ${wparam} ${lparam}
${EndSelect}

!macroend

Function .onInit
InitPluginsDir
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS 'cutmpage.ini' 'cutmpage.ini'
FunctionEnd

Function create
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG 'cutmpage.ini'
Call checktest2
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd

Function check
!insertmacro MUI_INSTALLOPTIONS_READ $0 'cutmpage.ini' 'Settings' 'State'
StrCmp $0 0 done
StrCmp $0 1 test1
StrCmp $0 2 test2
StrCmp $0 3 test3
Abort

test1:
Call Checktest1
Abort

test2:
Call Checktest2
Abort

test3:
Call Checktest3
Abort

done:
FunctionEnd

Function checktest1
!insertmacro SendCMD 'cutmpage.ini' 'Field 1' 'HWND' ${BM_SETCHECK} 1 0
!insertmacro SendCMD 'cutmpage.ini' 'Field 2' 'HWND' ${BM_SETCHECK} 0 0
!insertmacro SendCMD 'cutmpage.ini' 'Field 3' 'HWND' ${BM_SETCHECK} 0 0
FunctionEnd

Function checktest2
!insertmacro SendCMD 'cutmpage.ini' 'Field 1' 'HWND' ${BM_SETCHECK} 0 0
!insertmacro SendCMD 'cutmpage.ini' 'Field 2' 'HWND' ${BM_SETCHECK} 1 0
!insertmacro SendCMD 'cutmpage.ini' 'Field 3' 'HWND' ${BM_SETCHECK} 0 0
FunctionEnd

Function checktest3
!insertmacro SendCMD 'cutmpage.ini' 'Field 1' 'HWND' ${BM_SETCHECK} 0 0
!insertmacro SendCMD 'cutmpage.ini' 'Field 2' 'HWND' ${BM_SETCHECK} 0 0
!insertmacro SendCMD 'cutmpage.ini' 'Field 3' 'HWND' ${BM_SETCHECK} 1 0
FunctionEnd

Section
SectionEnd


cutmpage.ini

[Settings]
NumFields=3

[Field 1]
Type=RadioButton
Text=test1
Left=0
Right=298
Top=43
Bottom=54
Flags=NOTIFY

[Field 2]
Type=RadioButton
Text=test2
Left=0
Right=301
Top=57
Bottom=65
Flags=NOTIFY

[Field 3]
Type=RadioButton
Text=test3
Left=0
Right=298
Top=68
Bottom=78
Flags=NOTIFY

There's a bug in the WM_COMMAND handling of InstallOptions which causes it to notify the leave function of buttons being painted. That happens because LBN_SELCHANGE has the same value of BN_PAINT.

That will be fixed in the next version. To fix it in your script, drop everything related to NOTIFY and simply use the GROUP on the first radio button. That'd handle the selection of the radio buttons automatically.


still not fixed, is it? :)


probably fixed with patch #1638984, see:
http://sourceforge.net/tracker/index...49&atid=373087