Archive: Two plugins


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


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


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


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


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


I avoid .NET Framework like the plague. So no, I don't have .NET Framework installed. ;)


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


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: )


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


Hi Stu, I have a question for you. Can EmbeddedLists.dll be used with installoptions' custom page?


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 :)


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


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


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?


Interesting. I'll have a good look at the code tomorrow.

-Stu


The Embedded Lists functionality can be achieved using InstallOptions and System plugins.


I would love to see the code to add a SysListView32 control :]

-Stu


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.


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.

I'm not sure what InstallOptionsEx has, but you can check that out (forum search).

-Stu


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)


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


Can I use ButtonEvent to catch clicks on the minimize/maximize/close buttons? Thanks.


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


Well,
I was thinking that it might help me with using Wansis and TrayIcon together.


So you'd like to call a function when the program is minimised or maximised?

-Stu


I was thinking that. But whenever you click the Tray Icon to minimize/maximize, it would call the function.


That would need to be a modification to the NotifyIcon plugin.
I'll see what I can do.

-Stu


Done.
http://nsis.sourceforge.net/File:NotifyIcon.zip

Check Examples\NotifyIcon folder.

-Stu