Archive: Listbox with checkboxes


Listbox with checkboxes
Hello,

Is it possible to have a listbox with a checkbox for every item in the listbox?
A bit like the one on the components page but I need it on a custom page.

Regards,
Johan


You can use the EmebeddedLists plug-in.

Stu


Yes and no (By using the system plugin and my subclass plugin you could do a custom draw listbox, but I assume this is out of reach for you)

But the win32 listview supports checkboxes (IE4+ IIRC) I believe someone has used the listview on custom pages before, try a forum search (You will also have to read about the listview on MSDN to find out which window style is required and the messages to send (you will have to allocate struct's with the system plugin so this is not a walk in the park))

You might also want to look into InstallOptionsEx, it might support the listview

Edit:
And as stu suggests, http://nsis.sourceforge.net/EmbeddedLists_plug-in


checkboxes in dynamic lists?
** solved **

hi,
I'm having a similar problem, I'd like to create a list where the items have checkboxes, however I want to build the list dynamically and EmbeddedLists requires the checkbox definitions to be in an .ini file.

I've tried this:

!define LVS_EX_CHECKBOXES 0x4

...

${NSD_CreateListBox} 0 0 100% 100% "List Box!"
var listbox
Pop $listbox

${NSD_LB_AddString} $listbox "blah"
${NSD_LB_AddString} $listbox "blah"
${NSD_LB_AddString} $listbox "blah"

and adding the following line in various spots:

${NSD_AddExStyle} $listbox ${LVS_EX_CHECKBOXES}

and it doesn't seem to do anything. By which I mean I get a listbox with 3 lines of "blah" and no checkboxes. I suspect I've missed something obvious. I'm afraid I don't know a great deal about windows coding.

any help would be appreciated..

thanks
blz


PS also tried doing it at creation time thus:

!define __NSD_ListBoxMultiselect_CLASS LISTBOX
!define __NSD_ListBoxMultiselect_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${LBS_DISABLENOSCROLL}|${LBS_HASSTRINGS}|${LBS_NOINTEGRALHEIGHT}|${LBS_NOTIFY}|${LBS_MULTIPLESEL}
!define __NSD_ListBoxMultiselect_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}|${LVS_EX_CHECKBOXES}
!insertmacro __NSD_DefineControl ListBoxMultiselect

but also doesn't work for me :(


PPS took a second look at the ListView extension now that it all makes a bit more sense to me and it works if you add ${LVS_EX_CHECKBOXES}.

# ListView + this works for me :up:
SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} 0 ${LVS_EX_CHECKBOXES}|${LVS_EX_FULLROWSELECT}

So, I suspect, maybe the control used in nsDialogs is different from the one in Listview? and the control in nsDialogs doesn't understand LVS_EX_CHECKBOXES? I'd be curious to know whether this was the case.. but anyway. I'm happy. thanks again.