Loading ...
Sorry, an error occurred while loading the content.

Re: [flexcoders] Select a Tree item on Right click

Expand Messages
  • milan kosir
    If I try to look from the user perspective, I would prefer control left click over doubleclick and I would prefer some visual representation (small down arrow
    Message 1 of 8 , Jul 1, 2006
    View Source
    • 0 Attachment
      If I try to look from the user perspective, I would prefer control left click over doubleclick and I would prefer some visual representation (small down arrow like context menus in dreamweaver/flash) over all other solutions.
      Milan

      On 7/1/06, Jason Hawryluk <jh@...> wrote:

      What do you all think about a double-click context menu, in stead of the right click context menu that flex provides. The problem with the flex one is that it confuses a user as to whether they are still in your app or some browser menu. Hence I see the oops syndrome.

       

      (definitely!)

       

      Create a double click flex context menu using the mx:menu ? would it work. Another benefit is mac users only have 1 button so I avoid right click like the plague. Although I also try to avoid double click as, in all my years of software development on thing you can be guaranteed in a user that continuously double clicks everything or randomly clicks stuff.

       

      Also basing things on the context menu when that is not common in a web app may place confusion. I might user test the double click idea though.

      It's not standard,but it could work and long as no vital actions are tied to it. An experianced user would soon discover it. 

       

      Thoughts ?

       

      Jason

       
       
      -----Message d'origine-----
      De : flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com]De la part de Michael Schmalle
      Envoyé : samedi 1 juillet 2006 01:24
      À : flexcoders@yahoogroups.com
      Objet : Re: [flexcoders] Select a Tree item on Right click

      Yes, I did this back in Flash.

      You have to write an event handler for the itemRollOver (if the event is still called) that. Record the index from the event. Then in your contextMenu handler have the first thing it does set the selectedIndex of the tree. At this time you can also access the node info, which is handy for populating the menu before it is 'rendered'.

      Peace, Mike

      On 6/30/06, Pottavathini, Sathish <spottavathini@... > wrote:

      Hi,

      I have a tree control and i added custom contextual menus on that tree.
      I'm trying to read the value of the tree node when i right click and select a custom contaxtual menu, i did not find a way to do this because right click is not selecting the tree item.

      If i left-click before right-clicking on it then i can get to it by using myTree.selectedItem. Is there any way i can get to the tree item that i right clicked on(without a left click)? Or force it to select the item when i right click on it?

      Thanks




      --
      What goes up, does come down.


    • Michael Schmalle
      Hi, Out of anything that should be learned with newer applications from the desktop is HELP HELP HELP. I know a lot of users don t read, but there are some
      Message 2 of 8 , Jul 1, 2006
      View Source
      • 0 Attachment
        Hi,

        Out of anything that should be learned with newer applications from the desktop is HELP HELP HELP.

        I know a lot of users don't read, but there are some situations you can force them to read something OR make an attractive icon that just wannts to be clicked for quick help tips.

        IE describing a part of your FLex app that uses the right click.

        I agree with milan, small pop down icons are the best chioce.

        Peace, Mike

        On 7/1/06, milan kosir <kosir.dev@...> wrote:

        If I try to look from the user perspective, I would prefer control left click over doubleclick and I would prefer some visual representation (small down arrow like context menus in dreamweaver/flash) over all other solutions.
        Milan

        On 7/1/06, Jason Hawryluk < jh@...> wrote:

        What do you all think about a double-click context menu, in stead of the right click context menu that flex provides. The problem with the flex one is that it confuses a user as to whether they are still in your app or some browser menu. Hence I see the oops syndrome.

         

        (definitely!)

         

        Create a double click flex context menu using the mx:menu ? would it work. Another benefit is mac users only have 1 button so I avoid right click like the plague. Although I also try to avoid double click as, in all my years of software development on thing you can be guaranteed in a user that continuously double clicks everything or randomly clicks stuff.

         

        Also basing things on the context menu when that is not common in a web app may place confusion. I might user test the double click idea though.

        It's not standard,but it could work and long as no vital actions are tied to it. An experianced user would soon discover it. 

         

        Thoughts ?

         

        Jason

         
         
        -----Message d'origine-----
        De : flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com]De la part de Michael Schmalle
        Envoyé : samedi 1 juillet 2006 01:24
        À : flexcoders@yahoogroups.com
        Objet : Re: [flexcoders] Select a Tree item on Right click

        Yes, I did this back in Flash.

        You have to write an event handler for the itemRollOver (if the event is still called) that. Record the index from the event. Then in your contextMenu handler have the first thing it does set the selectedIndex of the tree. At this time you can also access the node info, which is handy for populating the menu before it is 'rendered'.

        Peace, Mike

        On 6/30/06, Pottavathini, Sathish <spottavathini@... > wrote:

        Hi,

        I have a tree control and i added custom contextual menus on that tree.
        I'm trying to read the value of the tree node when i right click and select a custom contaxtual menu, i did not find a way to do this because right click is not selecting the tree item.

        If i left-click before right-clicking on it then i can get to it by using myTree.selectedItem. Is there any way i can get to the tree item that i right clicked on(without a left click)? Or force it to select the item when i right click on it?

        Thanks




        --
        What goes up, does come down.





        --
        What goes up, does come down.
      • Pottavathini, Sathish
        I have tried this and it has way too many side effects. I tried using mouseEvent.target and it s not a reference to itemRenderer or DataGridItemRenderer. I
        Message 3 of 8 , Jul 5, 2006
        View Source
        • 0 Attachment
          I have tried this and it has way too many side effects.
           
          I tried using mouseEvent.target and it's not a reference to itemRenderer or DataGridItemRenderer. I also tried "relatedObject", and it's different in different cases!
           
          If this worked with you guys then do you mind posting a simple example?
           
          Mine is something like following...
           
          <mx:Tree horizontalScrollPolicy="on" id="tree_browseGridTree"
                width="100%" height="100%"
                focusInEffect="false" labelField="@label" showRoot="true"
                showDataTips="true"
                dataTipField="@label"
                dataProvider="{XML_TreeData}"
              &nb

          (Message over 64 KB, truncated)
        • Joan Tan
          Sathish! It s been a while since we worked together at our old company Cybrant. I guess it s a small software world and we ve crossed paths again. Anyways,
          Message 4 of 8 , Jul 5, 2006
          View Source
          • 0 Attachment

            Sathish! It’s been a while since we worked together at our old company Cybrant. I guess it’s a small software world and we’ve crossed paths again.

             

            Anyways, since Deepa is out of the office for a bit, I’ll see if I can help.  From the code you have provided, try to change the mouseOut and mouseOver events to itemRollOver and itemRollOut which are of type ListEvent. Then, in your setItemIndex function, I changed it to:

             

            private function setItemIndex(e:ListEvent) : void

            {

                selectedTreeItemIndex = TreeItemRenderer(e.itemRenderer).listData.rowIndex;

                Alert.show("Selected Tree Index: " + selectedTreeItemIndex);

            }

             

            This should get you the item that the user last moused over.

             

            Joan


            From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ] On Behalf Of Pottavathini, Sathish
            Sent: Wednesday, July 05, 2006 10:19 AM
            To: flexcoders@yahoogroups.com
            Cc: Michael Schmalle
            Subject: RE: [flexcoders] Select a Tree item on Right click

             

            I have tried this and it has way too many side effects.

             

            I tried using mouseEvent.target and it's not a reference to itemRenderer or DataGridItemRenderer. I also tried "relatedObject", and it's different in different cases!

             

            If this worked with you guys then do you mind posting a simple example?

             

            Mine is something like following...

             

            <mx:Tree horizontalScrollPolicy="on" id="tree_browseGridTree"
                  width="100%" height="100%"
                  focusInEffect="false" labelField="@label" showRoot="true"
                  showDataTips="true"
                  dataTipField="@label"
                  dataProvider="{XML_TreeData}"
                  contextMenu="{myContextMenu}"
                  creationComplete="onRightClick(event)"
                  mouseOver="setItemIndex(event)"
                  mouseOut="clearItemIndex(event)"
                  itemClose="onTreeNodeClose(event)"
                  itemOpen="onTreeNodeOpen(event)" />

             

            private var selectedTreeItemIndex :int = -1;

            private function clearItemIndex(e:MouseEvent) : void
            {
             selectedTreeItemIndex = -1;
            }

            private function setItemIndex(e:MouseEvent) : void
            {
             selectedTreeItemIndex = DataGridItemRenderer(e.relatedObject).listData.rowIndex;
             Alert.show("Selected Tree Index: " + selectedTreeItemIndex);
            }

            -----Original Message-----
            From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ]On Behalf Of Deepa Subramaniam
            Sent: Friday, June 30, 2006 4:27 PM
            To: flexcoders@yahoogroups.com
            Subject: RE: [flexcoders] Select a Tree item on Right click

            Well, good news and bad news. Normally, the event object properties on the ContextMenuEvent would help you accomplish what you’re asking for in a cinch. The mouseTarget property on a ContextMenuEvent contains a reference to the display list object which the user was over when the context menu was invoked. In most list-classes, like DataGrid, the mouseTarget is the specific renderer the user right-clicked over. This is perfect, because the renderer contains a lot of information that allows you to figure out where the user invoked the context menu. For example, off a DataGridItemRenderer object, you can access the listData property which contains the index of the row the user right-clicked on (listData is a BaseListData object which has the property, rowIndex). Then you’d just set your DataGrid’s selectedIndex to rowIndex and voila – the row the user right-clicked over is selected.

             

             

            Unfortunately, there is a bug that does not allow this to work for Tree. The bug was deferred for the 2.0 release because it was found late in the development cycle. When a ContextMenu is invoked over a Tree, ContextMenuEvent.mouseTarget is not the TreeItemRenderer instance that the user was hovering over. Instead, it’s the generic container for the TreeItemRenderer. This does not give us any useful information.

             

            There is a workaround, albeit a kludgy workaround, that you could try. In your ContextMenuEvent handler, you could add an event listener for the MouseEvent.MOUSE_OVER event. Your MOUSE_OVER handler could then work off the information contained in the MouseEvent.target property and (hopefully that is a reference to the TreeItemRenderer) you can figure out the rowIndex like I mentioned above and set the selectedIndex of the Tree accordingly. Then, be sure to remove the event listener at the end of your MOUSE_OVER handler so that the Tree is not constantly spewing MOUSE_OVER events.


            Whew – that was a mouthful but hopefully you followed and you’ll be able to live with the bug and or implement the workaround. I can’t make any promises but I’d like to see this bug fixed so I’ll definitely add your usecase to the bug to give it some momentum.

             

            HTH –

            Deepa Subramaniam

            Flex SDK

             


            From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ] On Behalf Of Pottavathini, Sathish
            Sent: Friday, June 30, 2006 3:50 PM
            To: flexcoders@yahoogroups.com
            Subject: [flexcoders] Select a Tree item on Right click

             

            Hi,

            I have a tree control and i added custom contextual menus on that tree.
            I'm trying to read the value of the tree node when i right click and select a custom contaxtual menu, i did not find a way to do this because right click is not selecting the tree item.

            If i left-click before right-clicking on it then i can get to it by using myTree.selectedItem . Is there any way i can get to the tree item that i right clicked on(without a left click)? Or force it to select the item when i right click on it?

            Thanks

          Your message has been successfully submitted and would be delivered to recipients shortly.