Announcement

Collapse
No announcement yet.

List Boxes?

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

  • List Boxes?

    I hope this isn't going to sound like a silly question.....

    I am writing my own front-end in VB.Net and would like to know what sort of 'list boxes' other front-ends use when displaying the play lists and when searching through directories etc. Is there a way of making a basic listbox look like these, or do you have to create your own 'control', made up of labels and some fancy code?

    Thanks for any help
    ViVE - Volkswagen In Van Entertainment:

    VoomPC 2, VIA C7 2GHz
    7" Lilliput
    120Gb Sata drive
    1GB RAM


    [||||||||||] 100% - Planning
    [||||||||||] 100% - Software coding
    [||||||||||] 100% - Built

    (Always tweaking!)

  • #3
    Thanks for the quick reply. I have had a look at the RR source code, but I can't really understand how it works.

    I was thinking something along the lines of having about 10 Labels and a couple of buttons for page-up and page-down. I would load the relevant data (directories, mp3 files etc.) into an array and display 10 of these on the labels. When page-down is pressed, the text on the 10 labels is replaced by the next 10 items in the list.

    Is this how it is done, or is there a better way of doing it?

    Thanks in advance....
    ViVE - Volkswagen In Van Entertainment:

    VoomPC 2, VIA C7 2GHz
    7" Lilliput
    120Gb Sata drive
    1GB RAM


    [||||||||||] 100% - Planning
    [||||||||||] 100% - Software coding
    [||||||||||] 100% - Built

    (Always tweaking!)

    Comment


    • #4
      Well if you put it all in a listbox, then all you have to do is scroll down. Labels can work, but what if you change the resolution. You will still only have 10 labels.
      Fusion Brain Version 6 Released!
      1.9in x 2.9in -- 47mm x 73mm
      30 Digital Outputs -- Directly drive a relay
      15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
      Buy now in the MP3Car.com Store

      Comment


      • #5
        Yeah, I realize 'listboxes' will automatically adjust the amount of displayed lines when the text size is changed, but I don't want a Windows looking front-end, is there anyway to remove the vertical scroll bars of a 'listbox' and make your own page-up, page-down buttons? Also, is it possible to have different colour text on different lines of the listbox?
        ViVE - Volkswagen In Van Entertainment:

        VoomPC 2, VIA C7 2GHz
        7" Lilliput
        120Gb Sata drive
        1GB RAM


        [||||||||||] 100% - Planning
        [||||||||||] 100% - Software coding
        [||||||||||] 100% - Built

        (Always tweaking!)

        Comment


        • #6
          Originally posted by portreathbeach View Post
          Yeah, I realize 'listboxes' will automatically adjust the amount of displayed lines when the text size is changed, but I don't want a Windows looking front-end, is there anyway to remove the vertical scroll bars of a 'listbox' and make your own page-up, page-down buttons? Also, is it possible to have different colour text on different lines of the listbox?
          Yes, Yes, Yes, I think so.

          .NET has the same "features" pretty much on VB.NET and C#.NET. I use C# mostly.

          I know in visual studio, you can just click the properties panel and disable vertical, horizontal, or both scrollbars.

          As for selecting manually I think the best way to do it, would be having a variable that stores how many items are shown at one time (and I say variable and not hardcoded because if you change the resolution, this number will change. Then have +/- 1 buttons (go up/down 1 item), as well as +/- VARIABLE_OF_ITEMS_IN_ONE_DISPLAY (go up/down that amount sort of like page up/down buttons). And when the selected item changes in .NET, it will move that item into view. You can enable/disable that too.

          As for changing the colour of each item, say I think so, because I think that list boxes can use rich text, and I know rich text you can individually code each character if you wanted to.

          If you don't want it windows looking then you might want to go with the label and changing the .text and then .update() all the label at once sort of thing. If you do it this way, you might want to only .update() the labels that are ontop and not in other panels/forms because it does slow it down a bit and in a big program it will matter and in an application where it will be playing music or displaying video you don't want jitters!
          Fusion Brain Version 6 Released!
          1.9in x 2.9in -- 47mm x 73mm
          30 Digital Outputs -- Directly drive a relay
          15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
          Buy now in the MP3Car.com Store

          Comment


          • #7
            Thanks for the advice. I have tried to disable the vertical scroll bar, but when the list gets bigger than the window, it automaticaly comes back. Maybe it's me being stupid, I'll guve it another go tonight.

            What you said about changing the text and updating the labels all in one go is the sort of thing I had in mind. I just wanted to know if there was an easier way of doing it. I'll have another look at listboxes.
            ViVE - Volkswagen In Van Entertainment:

            VoomPC 2, VIA C7 2GHz
            7" Lilliput
            120Gb Sata drive
            1GB RAM


            [||||||||||] 100% - Planning
            [||||||||||] 100% - Software coding
            [||||||||||] 100% - Built

            (Always tweaking!)

            Comment


            • #8
              This is the portion I'm working on at the moment, as well. I'm making my own control, using labels. I've thought of the whole resolution issue, and haven't came up with a good solution, other than dynamically creating the labels, and label properties based on an integer which would be passed in. I'd like to see some other solutions as well.
              Play with it, 'til it's broke.

              Comment


              • #9
                I made my own listbox control in vb6.

                I add (and delete) labels based on the size of the usercontrol.
                I then use the amount of displayed labels to show my list.

                I'ts also made transparent using BitBlt api.

                This is close to what's being done in RoadRunner I think.

                Cheers
                Borte
                Failure is not an option...
                __________________________________________________ ______________________________
                The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

                Comment


                • #10
                  Yeah, this bit is tricky. Last night I managed to make a list box without scroll bars. I simply put the list box on a panel and made the listbox hang out the side, so the vertical scroll bar is not seen. I then used the PostMessage command to Page-Up and Page-Down the list box. It's OK, but still a bit crappy.

                  I think I will end up using labels as my control as the blue selected item bar still looks crap, even if the rest of the control looks OK.

                  When you make your controls out of labels, do you have the facility to change the font size after the control is initialized. ie. If you had 10 labels in your control and then changed to a larger fontsize, you would end up with labels close together or even overlapped text.

                  Thanks again for the replies
                  ViVE - Volkswagen In Van Entertainment:

                  VoomPC 2, VIA C7 2GHz
                  7" Lilliput
                  120Gb Sata drive
                  1GB RAM


                  [||||||||||] 100% - Planning
                  [||||||||||] 100% - Software coding
                  [||||||||||] 100% - Built

                  (Always tweaking!)

                  Comment


                  • #11
                    well to prevent overlap, just move all labels above the selected one to:


                    Label.Position = Label.Position - FonSize/2 + Padding


                    ...and all labels below the selected one move to:


                    Label.Position = Label.Position + FonSize/2 + Padding
                    Fusion Brain Version 6 Released!
                    1.9in x 2.9in -- 47mm x 73mm
                    30 Digital Outputs -- Directly drive a relay
                    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
                    Buy now in the MP3Car.com Store

                    Comment


                    • #12
                      Originally posted by portreathbeach View Post
                      When you make your controls out of labels, do you have the facility to change the font size after the control is initialized. ie. If you had 10 labels in your control and then changed to a larger fontsize, you would end up with labels close together or even overlapped text.
                      In my listbox you can only set the options at initialization time but I have created an "BuildList" routine to initialize the listbox. This is called when loading the form its used in. By doing this I can change whatever I want and then just rebuild the list using "BuildList". This would then delete the previously created controls (labels) and then add new ones with the new data.

                      So how the control behaves when you're changing to a bigger fontsize would be up to the coding of the usercontrol (ie. you).

                      Cheers
                      Borte
                      Failure is not an option...
                      __________________________________________________ ______________________________
                      The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

                      Comment


                      • #13
                        Am I missing something? Why wouldn't you be able to change the font size after initialization? If I'm not mistaken, shouldn't you just be able to set the font size on the control itself, and the labels inherit it automatically? (assuming you're not basing the label size off of the font size)
                        Play with it, 'til it's broke.

                        Comment


                        • #14
                          I am basing the label size of the font size (I actually use autosize to get the correct height). This is easier instead of calculating the correct height.
                          I could change the font directly but this wouldnt rescale the labels unless I use "BuildList" afterwards...

                          Cheers
                          Borte
                          Failure is not an option...
                          __________________________________________________ ______________________________
                          The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

                          Comment


                          • #15
                            Thanks for your contributions. I've started to make my control. I have got it to build labels to fill the size of the control automatically on load-up. I use a FOR NEXT loop to place the labels and name them, label1, label2, label3.... I cannot get a click event to work with any of these labels.

                            I used the same syntax to declare the sub click event that is normally generated when you first double click a label that you drag into the form, but it doesn't work.

                            Sorry if this is a stupid question, but I've only been programming VB.Net for 10 weeks, and I have managed everything else, Winamp control, volume control, radio etc. using handles and sendmessages, but haven't done anything with custom controls.

                            thanks again
                            ViVE - Volkswagen In Van Entertainment:

                            VoomPC 2, VIA C7 2GHz
                            7" Lilliput
                            120Gb Sata drive
                            1GB RAM


                            [||||||||||] 100% - Planning
                            [||||||||||] 100% - Software coding
                            [||||||||||] 100% - Built

                            (Always tweaking!)

                            Comment

                            Working...
                            X