Combobox menu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rikard
    Forum Member
    • May 2005
    • 21

    Combobox menu

    Hi I am just playing around with autoplay and trying to learn how it works.
    If anyone has the time to answer my question I would appreciate it and maybe I learn something.

    I want to make a combobox dropdown menu.
    I want it to take all my pages add them to the menu and page.jump to selected page

    Sorry if im writing kind of short but my English is not the best.

    Thanks
    Rikard
  • yosik
    Indigo Rose Customer
    • Jun 2002
    • 1858

    #2
    You can use the following actions:

    -- read page names into table
    all_pages = Application.GetPages();

    -- count number of pages
    ttl_pages = Table.Count(all_pages);

    --Populate your Combo Box (starting from page 2 as page1 is where your combo box is located)
    ComboBox.SetUpdate("yourCombo", false);
    for i = 2, ttl_pages do
    ComboBox.AddItem ("yourCombo", all_pages[i],"");
    end
    ComboBox.SetUpdate("yourCombo", true);

    Good luck

    Yossi

    Comment

    • TJ_Tigger
      Indigo Rose Customer
      • Sep 2002
      • 3159

      #3
      I have done this as well. If you don't want your page to be visible in the combobox you can add this

      -- read page names into table
      all_pages = Application.GetPages();

      -- count number of pages
      ttl_pages = Table.Count(all_pages);

      --Populate your Combo Box (starting from page 2 as page1 is where your combo box is located)
      ComboBox.SetUpdate("yourCombo", false);
      for i = 1, ttl_pages do
      if all_pages[i] ~= Application.GetCurrentPage() then
      ComboBox.AddItem ("yourCombo", all_pages[i],"");
      end
      end
      ComboBox.SetUpdate("yourCombo", true);
      TJ-Tigger
      "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
      "Draco dormiens nunquam titillandus."
      Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

      Comment

      • Rikard
        Forum Member
        • May 2005
        • 21

        #4
        Thanks for the answer.
        TJ_Tiger you are refering to the number in the combobox of the file thats not gona show.
        Lets say im adding alot of files so that number wont be corect.
        e.g. i have 2 files that i dont want to show "file1 and "file2" is it posible to putt in the names instead in the code or maby even better putt some code on the page that i dont want to show so it wont show up in the list

        Comment

        • TJ_Tigger
          Indigo Rose Customer
          • Sep 2002
          • 3159

          #5
          Originally posted by Rikard
          Thanks for the answer.
          TJ_Tiger you are refering to the number in the combobox of the file thats not gona show.
          Lets say im adding alot of files so that number wont be corect.
          e.g. i have 2 files that i dont want to show "file1 and "file2" is it posible to putt in the names instead in the code or maby even better putt some code on the page that i dont want to show so it wont show up in the list

          Certainly,

          All you need to do is add some if this or that statements or use a table containing all the page names you don't want to display. Yoss's code is great for dynamically filling the ComboBox, that way if you add more pages they will be added to the list automatically. No additional coding required from you. If you have pages you don't want to be displayed you can do this:

          -- read page names into table
          all_pages = Application.GetPages();

          -- count number of pages
          ttl_pages = Table.Count(all_pages);

          -- reset the comboBox content
          ComboBox.ResetContent("yourCombo");

          --Populate your Combo Box (starting from page 2 as page1 is where your combo box is located)
          ComboBox.SetUpdate("yourCombo", false);
          for i = 1, ttl_pages do
          --list of pages not to show. As long as the name is not equal to one of
          -- these pages will not be displayed.
          if all_pages[i] ~= "EasterEgg" or all_pages[i] ~= "Secret" or all_pages[i] ~= "Admin" then
          ComboBox.AddItem ("yourCombo", all_pages[i],"");
          end
          end
          ComboBox.SetUpdate("yourCombo", true);
          TJ-Tigger
          "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
          "Draco dormiens nunquam titillandus."
          Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

          Comment

          • TJ_Tigger
            Indigo Rose Customer
            • Sep 2002
            • 3159

            #6
            Another option I have used recently is to have a string containing a list of names not to be displayed and then using String.Find to search the string and if it is not found then add the list.

            -- read page names into table
            all_pages = Application.GetPages();

            -- count number of pages
            ttl_pages = Table.Count(all_pages);

            -- reset the comboBox content
            ComboBox.ResetContent("yourCombo");

            --Populate your Combo Box (starting from page 2 as page1 is where your combo box is located)
            ComboBox.SetUpdate("yourCombo", false);

            --Define string of pages not to find
            strSearchMe = "Admin, Secret, EasterEgg, Yadayadayada, George, Kramer";

            for i = 1, ttl_pages do
            --list of pages not to show. As long as the name is not found (-1) in the string
            -- these pages will not be displayed.
            if String.Find(strSearchMe, all_Pages[i], 1, false) == -1 then
            ComboBox.AddItem ("yourCombo", all_pages[i],"");
            end
            end
            ComboBox.SetUpdate("yourCombo", true);
            TJ-Tigger
            "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
            "Draco dormiens nunquam titillandus."
            Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

            Comment

            • Rikard
              Forum Member
              • May 2005
              • 21

              #7
              Thanks for the replies I will play with it for a while now.

              I’m amazed every time I take a look in this forum an sees all the fast and explaining replies.
              I think I will start an AMS religion

              Comment

              • yosik
                Indigo Rose Customer
                • Jun 2002
                • 1858

                #8
                Yes, you're right TJ. A correct addendum. Thanks
                Yossi

                Comment

                Working...
                X