incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Kessler (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FLEX-33190) GridEvent.GRID_DOUBLE_CLICK is dispatched even when two different cells are clicked
Date Mon, 10 Sep 2012 12:27:07 GMT

     [ https://issues.apache.org/jira/browse/FLEX-33190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mark Kessler updated FLEX-33190:
--------------------------------

    Attachment: Grid.as

Here is a possible fix for it.  Added a new variable to track the last row clicked and does
a check for it in the doubleclick. This should also correct lack of single click events being
triggered.  Was unable to recompile the SDK with ant to test properly.

    private var lastClickRowIndex:int = -1;

    private function dispatchGridClickEvents(mouseEvent:MouseEvent, gridXY:Point, rowIndex:int,
columnIndex:int):void
    {
        var dispatchGridClick:Boolean = (rowIndex == mouseDownRowIndex &&
                                         columnIndex == mouseDownColumnIndex);
        var newClickTime:Number = getTimer();
        
        // In the case that we dispatched a click last time, check if we
        // should dispatch a double click this time.
        // This isn't stricly adequate, since the mouse might have been on a different cell
for 
        // the first click.  It's not clear that the extra checking would be worthwhile.
        if (doubleClickEnabled && dispatchGridClick && !isNaN(lastClickTime)
&&
            (newClickTime - lastClickTime <= DOUBLE_CLICK_TIME) && rowIndex ==
lastClickRowIndex)
        {
            dispatchGridEvent(mouseEvent, GridEvent.GRID_DOUBLE_CLICK, gridXY, rowIndex, columnIndex);
            lastClickTime = NaN;
            lastClickRowIndex = -1;
            return;
        }
        
        // Otherwise, just dispatch the click event.
        if (dispatchGridClick)
        {
            dispatchGridEvent(mouseEvent, GridEvent.GRID_CLICK, gridXY, rowIndex, columnIndex);
            lastClickTime = newClickTime;
            lastClickRowIndex = rowIndex;
        }
    }

                
> GridEvent.GRID_DOUBLE_CLICK is dispatched even when two different cells are clicked
> -----------------------------------------------------------------------------------
>
>                 Key: FLEX-33190
>                 URL: https://issues.apache.org/jira/browse/FLEX-33190
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: Grid
>    Affects Versions: Apache Flex 4.8 (parity release)
>            Reporter: Shigeru Nakagaki
>         Attachments: DataGridTest.mxml, Grid.as
>
>
> In dispatchGridClickEvents method of "s:Grid" class, GridEvent.GRID_DOUBLE_CLICK is dispatched.
But there is no check of whether the same cell was clicked.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message