/nsis-select

NSIS Select Pop-Up Dialog

Primary LanguageCBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

NSIS Select Pop-Up Dialog

The NSIS Select plugin provides a simple modal pop-up dialog from which the user may select from a list of items. It’s far simpler to use than the nsDialog plugin and doesn’t require creating an entire custom installer page when all you need is a simple combo box.

Requirements

The UNICODE plugin requires at least NSIS 3.0. The ASCII plugin should work with NSIS 2.xx. I haven’t tested (much) at all with NSIS 2.xx, so if there are issues using the plugin with that version, let me know.

API Documentation

CreateSelectDialog

Usage: ${CreateSelectDialog} RET ERR

Creates a SelectDialog, which then may be updated with additional function calls (add items, set text, etc.). This function must be called before any of the following functions. The SelectDialog may then be shown by calling the ShowSelectDialog function.

A return code is returned in the variable specified by RET. It will contain 0 if an error has occured, or 1 on success. The variable specified by ERR will contain the error message when an error occurs.

SelectDialogSetTitle

Usage: ${SelectDialogSetTitle} TITLE RET ERR

Set the SelectDialog's title to TITLE.

A return code is returned in the variable specified by RET. It will contain 0 if an error has occured, or 1 on success. The variable specified by ERR will contain the error message when an error occurs.

SelectDialogSetText

Usage: ${SelectDialogSetText} TEXT RET ERR

Set the SelectDialog's message text (displayed just above the selection combo box) to TEXT.

A return code is returned in the variable specified by RET. It will contain 0 if an error has occured, or 1 on success. The variable specified by ERR will contain the error message when an error occurs.

SelectDialogAddItem

Usage: ${SelectDialogAddItem} ITEM RET ERR

Add ITEM to the SelectDialog's combo box. Call SelectDialogAddItem multiple times to add multiple items. Items added will appear in the SelectDialog's combo box list in the order they are added.

A return code is returned in the variable specified by RET. It will contain 0 if an error has occured, or 1 on success. The variable specified by ERR will contain the error message when an error occurs.

SelectDialogSetSelection

Usage: ${SelectDialogSetSelection} ITEM RET ERR

Set the SelectDialog's current selection to ITEM. ITEM must have already been added to the SelectDialog via SelectDialogAddItem.

A return code is returned in the variable specified by RET. It will contain 0 if an error has occured, or 1 on success. The variable specified by ERR will contain the error message when an error occurs.

ShowSelectDialog

Usage: ${ShowSelectDialog} RET RESULT

Show the SelectDialog. On success the selected item will be return in the variable specified by RESULT. The SelectDialog is destroyed upon completion of this function.

A return code is returned in the variable specified by RET. It will contain 0 if an error has occured, or 1 on success. The variable specified by RESULT will contain the selected item, or an error message if an error occurs.

DestroySelectDialog

Usage: ${DestroySelectDialog} RET ERR

Destroy the SelectDialog freeing up resources allocated. This should be used if for some reason ShowSelectDialog is never called.

A return code is returned in the variable specified by RET. It will contain 0 if an error has occured, or 1 on success. The variable specified by ERR will contain the error message when an error occurs.

Build Requirements

The following are the requirements for building with GCC:

  • Cygwin

  • mingw64-i686-gcc-core (Cygwin package)

  • make (Cygwin package)

  • unzip or p7zip (Cygwin package; optional; for unpacking distribution)

  • p7zip (Cygwin package; optional; for creating distribution packages (make dist))

Cygwin Build Instructions

Install Cygwin including the mingw64-i686-gcc-core compiler package, which should pull in mingw64-i686-runtime.

Then building should be as simple as running:

make

LICENSE

Copyright (c) 2020, Robert Gill
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.