[flexcoders] Re: Detecting a click on an empty part of AdvancedDataGrid
Try using the mouseFocusChange event. I've used it a few times for deselecting items in a list when anywhere else is clicked. For your needs, you may have to adapt it but give it a try. I have a blog post about it at: http://my.opera.com/darylducharme/blog/2007/12/14/hidden-gems-mousefocus\ change --- In flexcoders@yahoogroups.com, whatabrain [EMAIL PROTECTED] wrote: I have an AdvancedDataGrid which has a few rows, and lots of empty space. When I click on the empty space, I want all the rows to be deselected. How do I detect that I've clicked in an empty space? I tried using grid.getObjectsUnderPoint() in the click event, but the results aren't very useful. I guess I could depend on the fact that there are always more than three objects when I click on a real row, and exactly three when I click on empty space, but that seems like a bad thing to depend on. Who knows what future versions of Flex will add to the list? There must be a better way! Thanks.
[flexcoders] Re: Detecting a click on an empty part of AdvancedDataGrid
Thanks. That's very close to what I want. However, this method disables multiple-select. It deselects items when you click _anywhere_. I only want to deselect when you click on empty space. --- In flexcoders@yahoogroups.com, actionscript_czar [EMAIL PROTECTED] wrote: Try using the mouseFocusChange event. I've used it a few times for deselecting items in a list when anywhere else is clicked. For your needs, you may have to adapt it but give it a try. I have a blog post about it at: http://my.opera.com/darylducharme/blog/2007/12/14/hidden-gems- mousefocus\ change --- In flexcoders@yahoogroups.com, whatabrain junk1@ wrote: I have an AdvancedDataGrid which has a few rows, and lots of empty space. When I click on the empty space, I want all the rows to be deselected. How do I detect that I've clicked in an empty space? I tried using grid.getObjectsUnderPoint() in the click event, but the results aren't very useful. I guess I could depend on the fact that there are always more than three objects when I click on a real row, and exactly three when I click on empty space, but that seems like a bad thing to depend on. Who knows what future versions of Flex will add to the list? There must be a better way! Thanks.
[flexcoders] Re: Detecting a click on an empty part of AdvancedDataGrid
Also, when I change focus to another window and then back to the flex app, mouseFocusChange stops firing. It never fires again after that. --- In flexcoders@yahoogroups.com, whatabrain [EMAIL PROTECTED] wrote: Thanks. That's very close to what I want. However, this method disables multiple-select. It deselects items when you click _anywhere_. I only want to deselect when you click on empty space. --- In flexcoders@yahoogroups.com, actionscript_czar daryl@ wrote: Try using the mouseFocusChange event. I've used it a few times for deselecting items in a list when anywhere else is clicked. For your needs, you may have to adapt it but give it a try. I have a blog post about it at: http://my.opera.com/darylducharme/blog/2007/12/14/hidden-gems- mousefocus\ change --- In flexcoders@yahoogroups.com, whatabrain junk1@ wrote: I have an AdvancedDataGrid which has a few rows, and lots of empty space. When I click on the empty space, I want all the rows to be deselected. How do I detect that I've clicked in an empty space? I tried using grid.getObjectsUnderPoint() in the click event, but the results aren't very useful. I guess I could depend on the fact that there are always more than three objects when I click on a real row, and exactly three when I click on empty space, but that seems like a bad thing to depend on. Who knows what future versions of Flex will add to the list? There must be a better way! Thanks.
[flexcoders] Re: Detecting a click on an empty part of AdvancedDataGrid - SOLUTION
I found the solution to my problem. It depends on the fact that click is fired after itemClick. var m_processingItemClick:Boolean = false; private function onItemClick(event:ListEvent):void { processingItemClick = true; } private function onClick(event:MouseEvent):void { if (m_processingItemClick) m_processingItemClick = false; else grid.selectedIndex = -1; } --- In flexcoders@yahoogroups.com, whatabrain [EMAIL PROTECTED] wrote: Also, when I change focus to another window and then back to the flex app, mouseFocusChange stops firing. It never fires again after that. --- In flexcoders@yahoogroups.com, whatabrain junk1@ wrote: Thanks. That's very close to what I want. However, this method disables multiple-select. It deselects items when you click _anywhere_. I only want to deselect when you click on empty space. --- In flexcoders@yahoogroups.com, actionscript_czar daryl@ wrote: Try using the mouseFocusChange event. I've used it a few times for deselecting items in a list when anywhere else is clicked. For your needs, you may have to adapt it but give it a try. I have a blog post about it at: http://my.opera.com/darylducharme/blog/2007/12/14/hidden-gems- mousefocus\ change --- In flexcoders@yahoogroups.com, whatabrain junk1@ wrote: I have an AdvancedDataGrid which has a few rows, and lots of empty space. When I click on the empty space, I want all the rows to be deselected. How do I detect that I've clicked in an empty space? I tried using grid.getObjectsUnderPoint() in the click event, but the results aren't very useful. I guess I could depend on the fact that there are always more than three objects when I click on a real row, and exactly three when I click on empty space, but that seems like a bad thing to depend on. Who knows what future versions of Flex will add to the list? There must be a better way! Thanks.