6 Replies Latest reply: Jul 4, 2012 11:57 AM by Fonarix RSS

    Listbox with customized items




      I need to create a ListBox with custom items.

      Each item should consist of two elements: from static text on the left and edit text item on the right.

      I'm using ADM, is it possible to do?


      Thanks in advance.

        • 1. Re: Listbox with customized items
          A. Patterson Community Member

          By 'edit text' you mean a line edit control?


          You can definitely do that I believe with the ADM, but to do so you're likely going to need to do it with a custom ADM control. I've never exerted that much custom control over an item, but I don't see why you couldn't do that. It'll be a fair bit of work though.

          • 2. Re: Listbox with customized items
            Fonarix Community Member

            Thanks, for your reply.


            "custom ADM control" do you mean draw this item with primitives, like text, line etc?

            I'm asking because I need  something like list box, with variable name and possibility change dynamically this item in one entity.

            Maybe the best way just add column of static texts, column of edit controls and fake vertical scroll on the right, handle it...

            • 3. Re: Listbox with customized items
              A. Patterson Community Member

              Yeah, I mean you'd draw it with primitives. Honestly, I'm not sure how easy it is to do things like "When you click here, create a line edit control", etc. Other people have wanted to do the same thing you're talking about, I can remember them asking. I don't think they ever posted to say what they ended up doing (or if they had to give up even). One common idea that crops up in that is what you've suggested, ie. two columns of items and faking the scroll.


              I think it is possible to create a custom widget and have child widgets though with the ADM. so you might be able to do a custom control and add line edit & labels as rows, maybe draw the line between them or something. I'm not 100% sure though. You'd probably need to keep a collection of pointers for each column and manage adding/deleting them yourself, plus resizing the custom widget to display them. Probably not a terrible amount of trouble to test that with a couple of rows as a test. If that worked, the scrolling would take care of itself at least.

              • 4. Re: Listbox with customized items
                Fonarix Community Member

                During investigation I've found that ListBox with kADMMultiColumnListViewType will be ideal for me, first column will be not editable, and the second - editable.

                But this code works with an exception:


                ADMItemRef multiColList = sADMDialog->CreateItem(dlg, 88, kADMMultiColumnListViewType, &rect11, CustomMultiColumnListEntryInit, NULL, NULL );


                With another dialog item types works fine e.g. kADMScrollingViewType etc, but only kADMMultiColumnListViewType failed with an exception.



                • 5. Re: Listbox with customized items
                  A. Patterson Community Member

                  What is the 88? Does that correspond to a resource ID? If so, how is it setup? If not, is 88 just a random number to avoid collision? If you're using CreateItem(), it should be the latter, not the former.


                  If none of that is a problem, I'm at a bit of a loss.

                  • 6. Re: Listbox with customized items
                    Fonarix Community Member

                    Thank you for your help, but I did it with Edits and static texts, just show or hide them. I only have 0-8 items and visualize necessary count when needed:ScreenShot.png