4 Replies Latest reply on Jan 10, 2007 3:21 AM by 10basetom

    Using the Hand cursor

    10basetom
      I'm trying to change the default cursor (pointer) to the hand cursor in the following two cases, without much luck:

      1. Change cursor to hand when hovering over a ComboBox. I followed an Adobe tech article that instructed to add these properties to the component:

      useHandCursor="true" buttonMode="true" mouseChildren="false"

      This changes the cursor to the hand all right, but the problem is you are no longer able to select from the ComboBox :(.

      2. Change cursor to a hand when hovering over a chart data point. The only thing I can think of is to change the cursor using the dataTipFunction, but I haven't figured how to do that. I would like to use the system hand cursor instead of creating a custom cursor.

      Please advise.

      Thanks,
      Tom
        • 1. Re: Using the Hand cursor
          FlightGuy Level 1
          Try keeping everything as it is, but remove the mouseChildren="false", and that will prevent mouse events getting to the child controls.

          Tim
          • 2. Re: Using the Hand cursor
            10basetom Level 1
            Hi Tim,

            When I remove mouseChildren="false" the cursor no longer changes to a hand (in Flex 2). It doesn't look like this method is compatible with the ComboBox control.
            • 3. Re: Using the Hand cursor
              FlightGuy Level 1
              You're right - I tried it. The hand cursor appears when the mouse is over the border or over the button, but not over the child textInput control or the List control. If you extend the component you could probably set the buttonMode and useHandCursor on each of the children (and perhaps their children). You would have to register your own itemRenderer to be used by the List to present your items as well (assuming you want the hand for that too).

              I don't think it will be easy. Another option is to just set the cursor to the hand cursor on the mouseOver event and unset it on the mouseOut - see the doc on CursorManager. I don't know if you get access to than hand cursor class that flex uses.

              Sorry,
              Tim
              • 4. Re: Using the Hand cursor
                10basetom Level 1
                Hi Tim,

                I currently have a solution, but it's not as perfect as I'd like it to be. Following a great suggestion from a poster on actionscript.org, I extended the CursorManager class with two new methods: setHandCursor() and removeHandCursor(), using setBusyCursor() and removeBusyCursor() as a template. Now I just use these two methods on rollover events to access the hand cursor (as you also suggested above).

                The reason it's not a perfect solution is because I had to create a custom bitmap hand cursor instead of leveraging the system hand cursor. Two negative side effects of this:

                1. Sometimes the custom hand cursor movement is jerky (e.g., hovering over a pie chart series).

                2. By default Windows renders an alpha-shaded shadow below the cursor; however, if you use a bitmap cursor then you lose that effect, so it's inconsistent.

                I'm going to look through the SDK classes to see if there's a way I can extend the CursorManager class to use the system hand cursor instead of creating a custom bitmap cursor.

                Tom