4 Replies Latest reply on Apr 8, 2011 4:54 PM by Frinholp

    Using a cursor select a layout

    Frinholp

      Title

      Using a cursor select a layout

      Post

      Hi all

      I have developed a GUI where I have a 'sidebar' which is basically a cascading menu.

      e.g

      Menu

      Menu1
        Option1
        Option2
        Option3
      Menu2
      Menu3
      Menu4

      or.....

      Menu1
      Menu2
      Menu3
        Option1
        Option2
      Menu4

      Menus 1-4 would have their own layout, also the options.

      I would like to have keyboard control of this sidebar using the cursor keys.

      Has anybody developed a system using a similar technique, or anybody got any suggestions on how I would go about this?

      Determining the keypress is no problem.

      Using the OnKeyPress trigger, should I use a list to order the layouts, a series of if statements (so one script will do for all layouts, catering for every possibility ) , or for each individual layout, have the OnKeyPress trigger execute a script that loads the layout above/below?

      Maybe there is another technique? 

      Obviously the idea is to keep the script as small as possible to improve performance.

      Thanks in advance

      Lee

        • 1. Re: Using a cursor select a layout
          philmodjunk

          Can you describe this "side bar" in more detail?

          What is it exactly? A portal? Text in a field? A series of menu formatted fields?

          "I would like to have keyboard control of this sidebar using the cursor keys."

          So you press the down arrow and what should happen? The up, left and right arrows do what?

          • 2. Re: Using a cursor select a layout
            Frinholp

            Menu

            Menu1
              Option1
              Option2
              Option3
            Menu2
            Menu3
            Menu4

            or.....

            Menu1
            Menu2
            Menu3
              Option1
              Option2
            Menu4

            Each one of these menus or options have their own layout (above is my simplified sidebar in two states)

            I would like to use the cursor to move between layouts dependent on the current layout.

            Up cursor would switch from Menu2 to Menu1. Down cursor would switch from Menu1 to Menu2. I'm thinking a Carriage Return would load the Menu option, then similar would apply for the Options. Esc maybe to 'go back'.

            I can think of many ways to achieve this,; what technique do you feel would perform the best?

            Cheers

            Lee

            • 3. Re: Using a cursor select a layout
              philmodjunk

              I find myself imaging a script like this set to run from the layout with an OnLayoutKeystroke Trigger:

              set Variable [$Key ; value: Get ( TriggerKeyStroke ) ]
              If [ $Key = Char ( 28 ) /* up arrow */ ]
                  Set Variable [$$row ; value: min ( $$row + 1 ; 7 ) ]
                  Exit Script [false]
              Else If [ $Key = Char ( 29 ) /* down arrow * / ]
                  Set Variable [$$row ; value: Max ( $$row - 1 ; 1 ) ]
                  Exit Script [false]
              Else If [ $key = Char ( 13 ) /* Return */ ]
                  Go to Layout [ GetValue ( YourTable::gLayoutList ; $$row) ]
                  Exit Script [false]

              //and so forth...

              End IF

              If you used a portal to list the options in the side bar, conditional formatting can "highlight" the selected layout. If you used a global text field, you could still "highlight" the row, but you'd use a text formatting function to "highlight" the currently selected row of text in the field.

              If the layout is also used for data entry, you'll need to make sure that this trigger doesn't interfere with data entry.

              • 4. Re: Using a cursor select a layout
                Frinholp

                Thanks Phil

                I would never of thought of using a portal as my side bar.

                I will investigate over the weekend and update you on my developments.

                Lee