Announcement

Collapse
No announcement yet.

Problem in Designing cascading ListBoxes as menu

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

  • Problem in Designing cascading ListBoxes as menu

    Hi
    I'm a beginner in ams scripting, I'm trying to make a project with some list boxes as menu to categorize some videos and pd files, but I have a severe problem.

    I want to all submenus get closed when the user clicks on a major menu in different class (another branch of the tree)
    but the last submenu(list box) remains opened when I click on an item of another branch of the tree.
    how could I force all submenus get closed when I click on the blank space of the page or click on the upper level menu Item?

    I wish I could say what I meant clearly.

    btw I wanna not to use the menu bar, I wanna simulate menus by list boxes, any sample project does exist?

    please help me, thnx

  • #2
    Originally posted by mahdi86 View Post
    Hi
    I'm a beginner in ams scripting, I'm trying to make a project with some list boxes as menu to categorize some videos and pd files, but I have a severe problem.

    I want to all submenus get closed when the user clicks on a major menu in different class (another branch of the tree)
    but the last submenu(list box) remains opened when I click on an item of another branch of the tree.
    how could I force all submenus get closed when I click on the blank space of the page or click on the upper level menu Item?

    I wish I could say what I meant clearly.

    btw I wanna not to use the menu bar, I wanna simulate menus by list boxes, any sample project does exist?

    please help me, thnx
    Just a thought have you tried the tree plugin rather then listbox's and you would have to right your own code to close the others but on the On click o on focus of the main listbox you would have to empty and hide them in there
    Plugins or Sources MokoX
    BunnyHop 2021 Here

    Comment


    • #3
      just right now I have 41 list boxes and I need this much more (about 82 lists)
      Is that logical to work this way?

      You mean I have to hide them one by one in coding?

      Comment


      • #4
        I haven't use any plugin and I don't know how to use any

        could anybody help me?

        Comment


        • #5
          Originally posted by mahdi86 View Post
          I haven't use any plugin and I don't know how to use any

          could anybody help me?
          The listbox is a plugin build in there is also a object called Tree Object maybe look at that and maybe move some of the work over to that one, and you can create a loop or something to hide all the other listbox's and also empty them so you don't have to right the code to hide each of them long as your make your code moduler enough

          BUt that many list box's is crazy cheese bud, I would say try and clean it up a little.
          Plugins or Sources MokoX
          BunnyHop 2021 Here

          Comment


          • #6
            Would u plz suggest any other way rather than use this much list boxes?

            any customized menu or something else?

            Comment


            • #7
              Something like this may result in less clutter.

              Ulrich

              Comment


              • #8
                thanx I saw it b4 but it used complicated codes which I couldn't understand

                for example how to insert "file play" option on it's menu items and change item's color..and so on

                Comment


                • #9
                  I have already said another one to use the Tree Object its right next to the ListBox Object or like Ulrich showed you his demo, you can also use normal menus two.

                  Look open AMS, get many drinks and snakes, this is important, and mess with EVERY object they have, read the manual for actions related to that object at the time, also check the forum see if there are other examples of that object, we can't do this for you or make your think in any given way.

                  my hats off to you, you started a project how you felt best, but AMS is more then a template and ListBox's for sure.

                  Plugins or Sources MokoX
                  BunnyHop 2021 Here

                  Comment


                  • #10
                    thanx
                    I'll try Tree Object

                    that was kind of u helping me

                    Comment


                    • #11
                      Now I have a new problem
                      I want the Tree object to show completely Right To Left, N I used these codes:

                      This part in Global Functions:

                      function GetWindowLong(hWnd, nIndex)
                      return tonumber(DLL.CallFunction("user32.dll", "GetWindowLongA", hWnd..", "..nIndex, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)) end
                      function SetWindowLong(hWnd, nIndex, dwNewLong)
                      return tonumber(DLL.CallFunction("user32.dll", "SetWindowLongA", hWnd..", "..nIndex..", "..dwNewLong, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL))
                      end


                      And this part in On Show Of the Page:

                      function Right2Left()
                      local Object_hwnd
                      local ExStyle
                      local Type
                      local WS_EX_LAYOUTRTL = 4194304
                      -- For Window
                      Object_hwnd = Application.GetWndHandle()
                      ExStyle = GetWindowLong(Object_hwnd ,-20) SetWindowLong(Object_hwnd, -20, ExStyle +
                      WS_EX_LAYOUTRTL) objects = Page.EnumerateObjects( );
                      if objects ~= nil then
                      Application.SetRedraw(false)
                      for index, object in pairs(objects) do
                      Type = Page.GetObjectType(object)
                      -- For ComboBox
                      if Type == OBJECT_COMBOBOX then
                      Object_hwnd = ComboBox.GetProperties(object).WindowHandle ExStyle = GetWindowLong(Object_hwnd ,-20)
                      SetWindowLong(Object_hwnd, -20, ExStyle + WS_EX_LAYOUTRTL)
                      ComboBox.SetProperties(object, {ReadOrder = READ_RIGHT_TO_LEFT})
                      -- For Input
                      elseif Type == OBJECT_INPUT then
                      Input.SetProperties(object, {ReadOrder = READ_RIGHT_TO_LEFT, Alignment = ALIGN_RIGHT})
                      -- For ListBox
                      elseif Type == OBJECT_LISTBOX then
                      Object_hwnd = ListBox.GetProperties(object).WindowHandle
                      ExStyle = GetWindowLong(Object_hwnd ,-20)
                      SetWindowLong(Object_hwnd, -20, ExStyle + WS_EX_LAYOUTRTL) ListBox.SetProperties(object, {ReadOrder
                      = READ_RIGHT_TO_LEFT})
                      -- For RadioButton
                      elseif Type == OBJECT_RADIOBUTTON then
                      RadioButton.SetProperties(object, {TextAlignment = ALIGN_RIGHT, ReadOrder =READ_RIGHT_TO_LEFT, ButtonAlignment = BTN_ALIGN_RIGHT})
                      -- For Tree
                      elseif Type == OBJECT_TREE then
                      Object_hwnd = Tree.GetProperties(object).WindowHandle ExStyle = GetWindowLong(Object_hwnd ,-20)
                      SetWindowLong(Object_hwnd, -20, ExStyle + WS_EX_LAYOUTRTL) Tree.SetProperties(object, {ReadOrder =
                      READ_RIGHT_TO_LEFT}) end
                      end
                      Application.SetRedraw(true)
                      end
                      end


                      But this doesn't work!

                      Comment

                      Working...
                      X