views:

31

answers:

2

Set proprty of "buttonMode" and "useHandCursor" to true in DataGrid, it does not work as I expect. Only move the cursor to the edge between two rows, the hand cursor can show. What I expect is that no matter where the cursor is moved, it should always show hand cursor

following is one of itemRenderer:

<?xml version="1.0" encoding="utf-8"?>
<mx:Label 
    xmlns:mx="http://www.adobe.com/2006/mxml"
    useHandCursor="true" buttonMode="true">
    <mx:Script>
        <![CDATA[
            import valueObject.Employee;

            override public function set data(value:Object):void{
                super.data = value;
                var employee:Employee = value as Employee;
                this.text = employee.lastName;
            }
        ]]>
    </mx:Script>
</mx:Label>

alt text

alt text

A: 

Because when you are hoving over an "area with data" it's not the DG that's deciding what the cursor should be, it's whatever is being used as the ItemRenderer. So you should be setting the properties on the renderer, not the DG.

Gregor Kiddie
@Gregor I tried as you said, but still not exactly what I want. I use itemRenderer in DG, and set "buttonMode" and "useHandCursor" both in DG and itemRenderer to ture, but only when I move the cursor to the edge between two rows, the hand cursor can show. You can see the attched.
jason
What's the item renderer you are using? Remember its the display object at the top of the stack at the point the cursor is that's deciding what the cursor should be. If your item renderer is complicated you might have to set the properties on a few things.
Gregor Kiddie
A: 

To solve this, please tell us what itemRenderer you are using (i.e. a custom mx:Label) and maybe also post some code.

In Theory, it works like this:

  1. Create e.g. a custom mx:Label and name it "MyLabel.mxml"
  2. Set the buttonMocde and useHandCursor properties.
  3. Assign "MyLabel" to the itemRenderer property of your DataGrid. Be careful to adjust for paths information if using nested folders..

This should do the trick.

If this help, pleases vote for/mark this answer. THX

Czar