- NSIS Discussion
- Two plugins
Archive: Two plugins
Afrow UK
30th March 2006 17:51 UTC
Two plugins
Just so that people know that they exist, I've uploaded two plugins.
EmbeddedLists.dll
This displays a single selection, multiple selection or columned list box (with column headings and optional check boxes). The plugin takes its list box items from the NSIS stack. I wrote this plugin as even with the makensis 8192 string length build I felt it was unsafe when having a large number of list box items for InstallOptions list boxes (from an Internet source).
ButtonEvent.dll
A small 3KB dll that allows you to catch click events of any custom buttons on any NSIS dialogs. The buttons must be added to the UI files with Resource Hacker. The example included makes use of a custom button on the parent window (alongside the Next and Back buttons) and one on the Components page.
-Stu
Red Wine
30th March 2006 20:51 UTC
Hi Stu,
this ButtonEvent sounds like something was really missed!
It is that what I was looking for to figure some actions I have in my mind, yet, I was not able to find such code or to write one by my self.
Next, I'll check it deeply to find out how it works, thus where and how it will assists me.
Regards
Afrow UK
31st March 2006 08:16 UTC
Well basically you just need to add a button with Resource Hacker and give it a unique ID number.
If the button is on the parent dialog (105) then call the AddEventHandler function in .onGUIInit. If the button is on a child form (inner dialog) then call it in the pages' Show function.
With this accomplished, the buttons will act the same as the user clicking "Next" except an internal flag is set showing that the user in fact clicked on one of the custom buttons.
For custom buttons on the parent dialog, the WhichButtonID function should be called in all pages' Leave functions (to catch the click event for all pages of the installer).
For individual pages, the WhichButtonID only needs to be called for that pages' Leave function.
Hope that helps.
The example script displays this, but in script form.
-Stu
{_trueparuex^}
1st April 2006 13:00 UTC
The example of EmbeddedLists.dll caused the installer to crash, but it was one time crash only. It crashed after I clicked next button on the multi column page, but I am not sure about that. It might have been when initializing the check box page too.
My os is windows 2000
Afrow UK
1st April 2006 14:45 UTC
Do you have .NET Framework 1.1 installed? The plugin was written under MS VS.NET, but works fine on a Windows XP machine without .NET Framework installed. I don't have a Windows 2000 machine anymore either.
-Stu
{_trueparuex^}
1st April 2006 18:29 UTC
I avoid .NET Framework like the plague. So no, I don't have .NET Framework installed. ;)
Afrow UK
1st April 2006 18:37 UTC
I'll recompile it in C++6 tomorrow and I'll post here.
How often does it crash? Have you been able to get it to crash again?
-Stu
{_trueparuex^}
2nd April 2006 11:44 UTC
Yes actually I just got it to crash again. And I think I even can reproduce the crash. This time it crashed when I clicked the close button in the Installion complete page. This makes me wonder, maybe I used the cancel button instead of next button when it crashed last time. (I really should pay more attention while testing these things :rolleyes: )
Afrow UK
2nd April 2006 21:56 UTC
Hello.
I was able to recompile the plugin under VC++6 with minor changes. One thing that could be causing the crash (but I doubt it) is that the ListView_SetCheckState macro was undefined for VC++6 when MSDN said that it is defined from Windows 95 and upwards (with IE3+ installed). However, the compiler said otherwise.
If you could re-download from the same URL and try it out I'd be very greatful. If my assumptions are correct then I'll have to avoid using VS.NET for plugin work.
-Stu
zeeh3
3rd April 2006 12:21 UTC
Hi Stu, I have a question for you. Can EmbeddedLists.dll be used with installoptions' custom page?
RobGrant
3rd April 2006 12:28 UTC
These look cool! I don't quite understand the difference between your ButtonEvent and just using the NOTIFY flag on a custom button with appropriate exit code. I haven't looked at it, only at your description.
I point this out because in the future when people are searching the wiki, it would be worth having a clear explanation :)
Afrow UK
3rd April 2006 15:28 UTC
The explanation is pretty clear. You can't place a button on an existing NSIS dialog with InstallOptions. Adding it with ResourceHacker is the only way, and then it doesn't actually do anything when you click on it. This is where the ButtonEvent plugin comes in.
-Stu
Afrow UK
3rd April 2006 15:30 UTC
zeeh3: If you want to display a list box on an InstallOptions dialog, use Type=ListBox. Note that this is a basic control without the additional features that a ListView control has (multiple columns and column headings).
-Stu
{_trueparuex^}
3rd April 2006 19:33 UTC
Sorry to say, but it still crashes. Now it crashed just like the first crash. So I guess that was right after all.
Is anyone else having problems with this plugin?
Afrow UK
3rd April 2006 21:31 UTC
Interesting. I'll have a good look at the code tomorrow.
-Stu
iceman_k
3rd April 2006 23:44 UTC
The Embedded Lists functionality can be achieved using InstallOptions and System plugins.
Afrow UK
4th April 2006 09:00 UTC
I would love to see the code to add a SysListView32 control :]
-Stu
iceman_k
4th April 2006 12:49 UTC
It would be complex, but the System plugin is very powerful. Pretty much any Windows API can be invoked using it.
Right now I don't have the time, but maybe later I could look at it.
zeeh3
4th April 2006 15:19 UTC
Originally posted by Afrow UK
zeeh3: If you want to display a list box on an InstallOptions dialog, use Type=ListBox. Note that this is a basic control without the additional features that a ListView control has (multiple columns and column headings).
-Stu
I know that :)
I was just asking for an enhaced Listbox using your plugin with custom pages.
Afrow UK
4th April 2006 17:16 UTC
I'm not sure what InstallOptionsEx has, but you can check that out (forum search).
-Stu
SimonSez07
11th April 2006 22:55 UTC
how can i hide my custom button (placed where your "Try Me" button is on the example) for all pages after the welcome page? i only want the button to be pressable on the welcome page.
also trying to abort the installation after the button is pressed (after the button does its purpose, of course)
(thx for your plug-in stu)
Afrow UK
11th April 2006 23:01 UTC
Use Quit to close the installer. Abort when called in any pages' Leave function will just return the user back to the page.
To hide the button for all other pages; in their Show functions use:
GetDlgItem $R0 $HWNDPARENT id_num
ShowWindow $R0 ${SW_HIDE}
For the page for it to be shown on; use ${SW_SHOW} instead of ${SW_HIDE}. id_num is your button control ID defined through Resource Hacker.
-Stu
rmccue
12th April 2006 01:22 UTC
Can I use ButtonEvent to catch clicks on the minimize/maximize/close buttons? Thanks.
Afrow UK
12th April 2006 11:11 UTC
Hmm no I never thought of that :)
I should be able to add support for it if you want?
Edit: Well only the minimise and close buttons are usable, but the close button is the same as clicking on Cancel (MUI_CUSTOMFUNCTION_ABORT is called). As for minimise what would you want to do there?
-Stu
rmccue
13th April 2006 22:46 UTC
Well,
I was thinking that it might help me with using Wansis and TrayIcon together.
Afrow UK
13th April 2006 23:28 UTC
So you'd like to call a function when the program is minimised or maximised?
-Stu
rmccue
15th April 2006 01:08 UTC
I was thinking that. But whenever you click the Tray Icon to minimize/maximize, it would call the function.
Afrow UK
15th April 2006 10:13 UTC
That would need to be a modification to the NotifyIcon plugin.
I'll see what I can do.
-Stu
Afrow UK
15th April 2006 11:26 UTC
Done.
http://nsis.sourceforge.net/File:NotifyIcon.zip
Check Examples\NotifyIcon folder.
-Stu