How to make an app - Andromo App Maker

Announcement

Collapse
No announcement yet.

Remove multiple items from a Listbox

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

  • Remove multiple items from a Listbox

    As straightforward as this task might seem, I actually had a devil of a time trying to figure it out. Have in the past, been coding this one via a simple table iteration, not realizing that it was in fact deleting the wrong items from the Listbox. Could not for the life of me, work out why?

    And then finally realized, it just needed a do/while count-loop instead (Example attached).
    D'oh! Don't ya just love missing the obvious?
    Attached Files

  • #2
    Finding the simple and the obvious solution is more complicated sometimes than the complicated solution , i think i had just complicated my sentence.

    Good you solved it as usual , keep forward

    Comment


    • #3
      Additionally, you could also use a for loop, which is cleaner in my honest opinion
      Code:
      local tSelected = ListBox.GetSelected("ListBox1"); -- gets selected indexes from the ListBox, and stores in table
      if tSelected then -- ensures something is selected
          -- from the # of items in tSelected to 1, step -1 do
          for i = #tSelected, 1, -1 do 
              ListBox.DeleteItem("ListBox1", tSelected[i]);
          end 
      end
      Bas Groothedde
      Imagine Programming :: Blog

      AMS8 Plugins
      IMXLH Compiler

      Comment


      • #4
        Hello Bio and IP.. thanks for all your ideas...

        Comment


        • #5
          Originally posted by Imagine Programming View Post
          Code:
          for i = #tSelected, 1, -1 do
          I so like it when you drop by, IP.
          My man!



          Comment


          • #6
            Originally posted by BioHazard View Post
            I so like it when you drop by, IP.
            My man!


            I still linger these forums every single day, I can't seem to stay away!
            Bas Groothedde
            Imagine Programming :: Blog

            AMS8 Plugins
            IMXLH Compiler

            Comment


            • #7
              Originally posted by Imagine Programming View Post

              I still linger these forums every single day, I can't seem to stay away!
              i am not here every day but I come back at lest once a week, the place we used to have might be gone but I know I enjoyed it and maybe one day these new little devs will bring it back.
              BunnyHop CDD Obscurer Download No Longer Supported
              Plugins or Sources MokoX

              Comment


              • #8
                Originally posted by kingzooly View Post
                ...the place we used to have might be gone but I know I enjoyed it ...
                Hey, Rexxy - you're back! Was starting to worry we'd lost you over to the dark side. I agree, circa 2009-2011 was a fun time when this board was always lit up with both great chatter and great code.

                And now, so many have gone MIA: Rizla, reteset, Sakuya, Centauri Soldier, T3STY, Worm - the list goes on. And is passed time a rescue mission was mounted for our missing brothers - is not quite the same without them!

                But after 'arising from the dead' so to speak, I have to say, I'm very happy to see both you and IP are still here after all these years. Here's to the both of ya', my brothers!



                Comment


                • #9
                  Originally posted by BioHazard View Post
                  But after 'arising from the dead' so to speak, I have to say, I'm very happy to see both you and IP are still here after all these years. Here's to the both of ya', my brothers!


                  I guess this is a nostalgic place for me haha!
                  Bas Groothedde
                  Imagine Programming :: Blog

                  AMS8 Plugins
                  IMXLH Compiler

                  Comment

                  Working...
                  X