- NSIS Discussion
- CheckedListBox in NSIS
Archive: CheckedListBox in NSIS
Ewgenijkkg
22nd October 2008 13:23 UTC
CheckedListBox in NSIS
Hello, guys. I wanted to place a CheckedListBox on one of the installer pages. Since there is no macro for this purpose, I tried to use the Windows API. I made the following command:
System::Call "user32::CreateWindow(i WC_LISTVIEW, t 'blub', i WS_CHILD | i LVS_REPORT | i LVS_EDITLABELS | i WS_VISIBLE, i 0, i 0, i 50, i 15, i $HWNDPARENT, i (HMENU)ID_LISTVIEW, i hInst, *i 0) i .s"
That corresponds to http://msdn.microsoft.com/en-us/library/ms632679(VS.85).aspx specification of the CreateWindow command. But the control element does not appear on my installer page:(( What could be wrong???
BR
Ewgenij
Anders
22nd October 2008 14:09 UTC
WC_LISTVIEW is not the correct class name. I'm also not sure if you can OR things like you do, ex "i 1 | i 2", I think you need "i 1|2". Also, all the WS_ and LVS_ bits must be defines ${WS_VISIBLE} with the correct value, not just the text you get from MSDN. Once you get passed this you will find out that listview's use structs to add/edit items, so its just not a simple SendMessage call to add items
Ewgenijkkg
22nd October 2008 14:54 UTC
Hmm, OK. Can I create a listview with the
nsDialogs::CreateControl /NOUNLOAD class style extended_style x y width height text
command? But which values should I enter for class, style and extended_style?
Ewgenijkkg
22nd October 2008 16:25 UTC
To be honest, I just want to create a list box with checking option, which I can fill then dependent on the actual program configuration. What is the best way to achieve that?
BR
Ewgenij
Anders
22nd October 2008 22:01 UTC
listview class is SysListView32, for the styles, you can normally just google "define NAME_OF_STYLE", or look it up in a .h file if you have the windows sdk installed
Ewgenijkkg
27th October 2008 09:12 UTC
Hello! So I inserted the following command into my page create function:
nsDialogs::CreateControl /NOUNLOAD 'SysListView32' 0 0x00000004 100u 50u 50u 20u "blub"
But nothing appears on the page :cry: What is wrong??
Ewgenijkkg
27th October 2008 09:19 UTC
I also tried
nsDialogs::CreateControl /NOUNLOAD 'SysListView32' 0x08000000L 0x00000004 100u 50u 50u 20u "blub"
0x08000000L - WS_VISIBLE
0x00000004 - LVS_EX_CHECKBOXES
But it did not work too.
:igor:
NounouRs
27th October 2008 15:06 UTC
Why making so complicated just to add some check boxes ?
Is there no macro defined in the basic macros of NSIS ?
It's not rare to need that, so what...
I've found this help (that doesn't help me because I don't fully understand) that uses only MUI macro and ini files...
http://nsis.sourceforge.net/Custom_Finish_Page
Anders
27th October 2008 15:49 UTC
Ewgenijkkg: you at least need WS_CHILD+WS_VISIABLE
ZmAn3
27th October 2008 16:10 UTC
nsDialogs::CreateControl /NOUNLOAD 'SysListView32' ${DEFAULT_STYLES} 100u 50u 50u 20u "blub"
works fine not sure how your gonna handle all the sysListviews messages thou
Ewgenijkkg
28th October 2008 16:00 UTC
Originally posted by NounouRs
Why making so complicated just to add some check boxes ?
Is there no macro defined in the basic macros of NSIS ?
No, there isn't:(( At least, I did not find any.
I've found this help (that doesn't help me because I don't fully understand) that uses only MUI macro and ini files
And where do you see checkboxes there?
BR
Ewgenij
Ewgenijkkg
28th October 2008 16:01 UTC
Originally posted by ZmAn3
nsDialogs::CreateControl /NOUNLOAD 'SysListView32' ${DEFAULT_STYLES} 100u 50u 50u 20u "blub"
works fine not sure how your gonna handle all the sysListviews messages thou
Sorry, I have never programmed with Win32-API before. So I do not know a lot about it. You think, it will be impossible to implement the checkedlistbox in NSIs? And to work with it?
BR
Ewgenij
ZmAn3
28th October 2008 16:12 UTC
well id use the embedded lists plugin or if you always had a set number of checkboxes id totally just fake it you could make a white static control in nsdialogs with a border and place check boxes in there or if you look at nsdialogs.nsh he has macros for creating listboxes not sure what youd have to do to support check boxes in those thou
NounouRs
28th October 2008 16:14 UTC
An exctract of my code, using Modern UI :
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT $R7 #"Read Pdf"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION openPdf
!insertmacro MUI_PAGE_FINISH
This add a new checkbox at the last page (MUI_PAGE_FINISH) where there is already 1 checkbox for "launching application"
it is the simpliest I've found
Ewgenijkkg
28th October 2008 16:21 UTC
Originally posted by ZmAn3
well id use the embedded lists plugin or if you always had a set number of checkboxes id totally just fake it you could make a white static control in nsdialogs with a border and place check boxes in there or if you look at nsdialogs.nsh he has macros for creating listboxes not sure what youd have to do to support check boxes in those thou
I wish I had a static number of the items, but the number is dynamic :( What lists-plugin do you mean?
ZmAn3
29th October 2008 00:11 UTC
i have another question for you do they get to select more then one item?
Ewgenijkkg
29th October 2008 11:08 UTC
Originally posted by ZmAn3
http://nsis.sourceforge.net/EmbeddedLists_plug-in
Hey!!! That is exactly what I need! Thanks a lot. So, I do not need the whole Win32 API stuff. However, the plugin is based on Ini-Files, and you read in the new releases of NSIS that this approach is deprecated. Therefore it is better to use nsDialogs-Plugin instead of InstallOptions. So why is there no macro for checkedlistboxes?
BR
Ewgenij
Ewgenijkkg
29th October 2008 11:09 UTC
Originally posted by ZmAn3
i have another question for you do they get to select more then one item?
Yes, in the most cases:)