Old 30th March 2006, 17:51   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 30th March 2006, 20:51   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
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

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 31st March 2006, 08:16   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 1st April 2006, 13:00   #4
{_trueparuex^}
Senior Member
 
{_trueparuex^}'s Avatar
 
Join Date: Dec 2005
Location: Glow
Posts: 285
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
{_trueparuex^} is offline   Reply With Quote
Old 1st April 2006, 14:45   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 1st April 2006, 18:29   #6
{_trueparuex^}
Senior Member
 
{_trueparuex^}'s Avatar
 
Join Date: Dec 2005
Location: Glow
Posts: 285
I avoid .NET Framework like the plague. So no, I don't have .NET Framework installed.
{_trueparuex^} is offline   Reply With Quote
Old 1st April 2006, 18:37   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 2nd April 2006, 10:44   #8
{_trueparuex^}
Senior Member
 
{_trueparuex^}'s Avatar
 
Join Date: Dec 2005
Location: Glow
Posts: 285
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 )
{_trueparuex^} is offline   Reply With Quote
Old 2nd April 2006, 20:56   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 3rd April 2006, 11:21   #10
zeeh3
Senior Member
 
Join Date: Aug 2005
Posts: 121
Hi Stu, I have a question for you. Can EmbeddedLists.dll be used with installoptions' custom page?
zeeh3 is offline   Reply With Quote
Old 3rd April 2006, 11:28   #11
RobGrant
Senior Member
 
Join Date: Sep 2004
Location: Nottingham
Posts: 263
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
RobGrant is offline   Reply With Quote
Old 3rd April 2006, 14:28   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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 is offline   Reply With Quote
Old 3rd April 2006, 14:30   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 3rd April 2006, 18:33   #14
{_trueparuex^}
Senior Member
 
{_trueparuex^}'s Avatar
 
Join Date: Dec 2005
Location: Glow
Posts: 285
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?
{_trueparuex^} is offline   Reply With Quote
Old 3rd April 2006, 20:31   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Interesting. I'll have a good look at the code tomorrow.

-Stu
Afrow UK is offline   Reply With Quote
Old 3rd April 2006, 22:44   #16
iceman_k
NSIS Dev
 
iceman_k's Avatar
 
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
The Embedded Lists functionality can be achieved using InstallOptions and System plugins.

Cheers,
Iceman_K

EclipseNSIS - An NSIS IDE for the Eclipse Platform | My contributions to the wiki
iceman_k is offline   Reply With Quote
Old 4th April 2006, 08:00   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I would love to see the code to add a SysListView32 control :]

-Stu
Afrow UK is offline   Reply With Quote
Old 4th April 2006, 11:49   #18
iceman_k
NSIS Dev
 
iceman_k's Avatar
 
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
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.

Cheers,
Iceman_K

EclipseNSIS - An NSIS IDE for the Eclipse Platform | My contributions to the wiki
iceman_k is offline   Reply With Quote
Old 4th April 2006, 14:19   #19
zeeh3
Senior Member
 
Join Date: Aug 2005
Posts: 121
Quote:
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.
zeeh3 is offline   Reply With Quote
Old 4th April 2006, 16:16   #20
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I'm not sure what InstallOptionsEx has, but you can check that out (forum search).

-Stu
Afrow UK is offline   Reply With Quote
Old 11th April 2006, 21:55   #21
SimonSez07
Junior Member
 
Join Date: May 2003
Posts: 3
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)
SimonSez07 is offline   Reply With Quote
Old 11th April 2006, 22:01   #22
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 12th April 2006, 00:22   #23
rmccue
Member
 
Join Date: Aug 2005
Location: Australia
Posts: 71
Can I use ButtonEvent to catch clicks on the minimize/maximize/close buttons? Thanks.
rmccue is offline   Reply With Quote
Old 12th April 2006, 10:11   #24
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 13th April 2006, 21:46   #25
rmccue
Member
 
Join Date: Aug 2005
Location: Australia
Posts: 71
Well,
I was thinking that it might help me with using Wansis and TrayIcon together.
rmccue is offline   Reply With Quote
Old 13th April 2006, 22:28   #26
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
So you'd like to call a function when the program is minimised or maximised?

-Stu
Afrow UK is offline   Reply With Quote
Old 15th April 2006, 00:08   #27
rmccue
Member
 
Join Date: Aug 2005
Location: Australia
Posts: 71
I was thinking that. But whenever you click the Tray Icon to minimize/maximize, it would call the function.
rmccue is offline   Reply With Quote
Old 15th April 2006, 09:13   #28
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That would need to be a modification to the NotifyIcon plugin.
I'll see what I can do.

-Stu
Afrow UK is offline   Reply With Quote
Old 15th April 2006, 10:26   #29
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Done.
http://nsis.sourceforge.net/File:NotifyIcon.zip

Check Examples\NotifyIcon folder.

-Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump