Announcement

Collapse
No announcement yet.

CheckedListBox in NSIS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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
    IntOp $PostCount $PostCount + 1

    Comment


    • #3
      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?

      Comment


      • #4
        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

        Comment


        • #5
          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
          IntOp $PostCount $PostCount + 1

          Comment


          • #6
            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 What is wrong??

            Comment


            • #7
              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.

              Comment


              • #8
                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

                Comment


                • #9
                  Ewgenijkkg: you at least need WS_CHILD+WS_VISIABLE
                  IntOp $PostCount $PostCount + 1

                  Comment


                  • #10
                    nsDialogs::CreateControl /NOUNLOAD 'SysListView32' ${DEFAULT_STYLES} 100u 50u 50u 20u "blub"
                    works fine not sure how your gonna handle all the sysListviews messages thou

                    Comment


                    • #11
                      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

                      Comment


                      • #12
                        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

                        Comment


                        • #13
                          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

                          Comment


                          • #14
                            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

                            Comment


                            • #15
                              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?

                              Comment

                              Working...
                              X