View Full Version : [AS3] DataGrid
pizzafilms
06-16-2009, 03:06 AM
Please...someone...help!
I've been looking for hours and can't find how to set the focus to a specific cell in a DataGrid component in code. Crazy!
It seems you can setFocus to the ENTIRE component, but not a specific cell. How can there not be that functionality?
On the other hand, the DataGrid does have a SoundTransform property...(wtf?)
Thanks!
hioctane
06-21-2009, 11:24 PM
Have you tried:
var dgListener:Object = new Object();
dgListener.cellFocusIn = function(evt_obj:Object) {
var cell_str:String = "(" + evt_obj.columnIndex + ", " + evt_obj.itemIndex + ")";
trace("The cell at " + cell_str + " has gained focus");
};
// Add listener.
my_dg.addEventListener("cellFocusIn", dgListener);
pizzafilms
06-22-2009, 05:58 AM
Thanks, but it looks like your code tells me WHEN a cell has the focus. I want to SET the focus to a particular cell.
rocker
06-25-2009, 04:22 AM
By focus, I think you mean that you want to highlight the cell in some special way. Although I am not sure if there is a straightforward way to do so, a simple way would be to set a flag in the cell renderer data and use the in-focus skin when the cell's set data() function is called.
This way you will be able to pass set the flag of any particular cell you want to while creating the data provider.
pizzafilms
06-25-2009, 05:22 AM
Thanks for your reply.
Basically, I want to put the cursor in the proper cell when the user adds a new item to the list...like a good programmer should do. I hate it when I have to click somewhere just to start typing when that's the obvious thing to do.
I mean, seriously...who wrote this crap? There doesn't even seem to be an obvious way to access the contents of any cell.
Something like: something = myDataGrid.cell(column, row);
To quote myself,
"On the other hand, the DataGrid does have a SoundTransform property...(wtf?)"
rocker
06-25-2009, 06:08 PM
I agree with you. I am using tilelist extensively in my project and I feel like giving up every other day ;-)
pizzafilms
06-25-2009, 06:12 PM
Based on my limited use of the included Flash components...forget it. Roll your own. As daunting as that may seem depending on the component, you'll actually save yourself huge amounts of time.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.