|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Apr 2011
Posts: 6
|
button event plugin not working for more than one button in mui nsis
In GetButtonID function, when more than one button event handler is given ,then it autoexits before showing the Directory MUI page dialog.
But, when only one button event handler is given , then the Directory page is displayed without any problems. !include "MUI2.nsh" !define IDC_BUTTON_CDRIVEPATH 1200 !define IDC_BUTTON_DDRIVEPATH 1201 ;--------------------------------------- ;Name and file Name Remove_ERROR OutFile solve_error.exe ; ------------------------------- !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\setup.ico" ; !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\pksicon.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP"${NSISDIR}\Contrib\Graphics\Wizard\img.bmp" !define MUI_ABORTWARNING !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\licensefile.txt" !define MUI_PAGE_CUSTOMFUNCTION_SHOW GetButtonID ;---in this function only one button event handler works, if two handlers are given , then installer crashes !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ; -------------------------------------------------- ; Languages. !insertmacro MUI_LANGUAGE English # Called when the CDRIVEPATH button is pressed. Function CDRIVEPATH MessageBox MB_OK|MB_ICONEXCLAMATION "The Software will be installed in : C Drive" FunctionEnd Function DDRIVEPATH MessageBox MB_OK|MB_ICONEXCLAMATION "The Software will be installed in : D Drive" FunctionEnd ;-------------------------------- Function GetButtonID # Create event handler for inner window button. GetFunctionAddress $R2 CDRIVEPATH ButtonEvent::AddEventHandler ${IDC_BUTTON_CDRIVEPATH} $R2 ;when this second button handler is given ,then installer autoexits as soon as it has to show the Directory MUI Page dialog: GetFunctionAddress $R3 DDRIVEPATH ButtonEvent::AddEventHandler ${IDC_BUTTON_DDRIVEPATH} $R3 FunctionEnd ;------------------------------------------------------------------ Section "INSTALL MAIN SOFTWARE" SetOutPath $INSTDIR File /r "myfolder\*.*" SectionEnd ;------------------------------------------------------------------ |
|
|
|
|
|
#2 |
|
Senior Member
|
I tried ButtonEvent plugin with two buttons on the same page and it works perfectly
Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Apr 2011
Posts: 6
|
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Apr 2011
Posts: 6
|
sir, can you please tell me the error in my code? its not working, when i press the I AGREE button on License page, then the installer exits, but when i remove the handler of the second button from the GETBUTTONID function, then it works properly.
|
|
|
|
|
|
#5 |
|
Senior Member
|
Strange, your code is not working.
Plugin crashes on second ButtonEvent::AddEventHandler. There is probably bug in the plugin - I will ask Afrow. In my Graphical Installer I used exactly this code: PHP Code:
One button was for printing license and second for saving license to hard disk - both on the same page License. Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
|
Are you using Unicode NSIS or not? Be sure not to mix the plug-ins either.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Apr 2011
Posts: 6
|
sir, how do i come to know whether am using Unicode NSIS or not? please help
|
|
|
|
|
|
#8 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,848
|
If you downloaded NSIS from the NSIS website, then you have ANSI (non-Unicode) NSIS. The Unicode version is a special build. If you didn't explicitly look for it, you probably don't have it.
|
|
|
|
|
|
#9 |
|
Senior Member
|
I am sure about this, it some king of bug.
I have non-Unicode version of NSIS and non-Unicode plugin and installers crashes. But it crashes only in nsichildnew's script! - in my script (in reply #5) two buttons are working correctly! So I assume that plugin is OK, but some other thing (maybe incorrect order of some lines in script, etc) prevents it from working correctly. There is no time for me to debug it, but If you have some time try to debug script above by yourself. Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#10 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
|
I'll look into this bug later today.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#11 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
|
Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#12 |
|
Senior Member
|
Stu, could you add event for other controls to your plug-in?
E.g.: I added Label [Static text] in UI.exe and I would like to attach onClick event to it. Is is possible? Create cool looking Graphical Installers in NSIS: www.graphical-installer.com -see below I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned-softworks.sk Develop NSIS projects directly in Visual Studio 2005-2012: www.unsigned-softworks.sk/visual-installer/ |
|
|
|
|
|
#13 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
|
Sure it's possible but I would probably create a new plug-in that provides multiple event handlers. I will work on it when I have some free time.
Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
![]() |
|
|||||||
| Tags |
| mui nsis button plugin |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|