Dan Pride wrote:
> I have a screen with datagrid lists which list the basics.
> Users double click list items to display and enter further data.
> The screen does not display the values on the first change of the selected
> child canvas. After the first attempt it always does, but the "first
> impression" bites. Is there a way to get this to display first and every
> time???
>
> Basic function I am using on the doubleclick on the datagrid is:
>
> private function displayLoca():void{
> applicationScreens.selectedChild = locaScreen;
> locaName.text = locaGrid.selectedItem.NameCol;
> locaField.text = locaGrid.selectedItem.FieldCol;
> locaSquare.text = locaGrid.selectedItem.SquareCol;
> }
>
Maybe your TextInput objects have not been created at the time your
setting your data.
Try this instead:
private function displayLoca():void{
applicationScreens.selectedChild = locaScreen;
locaScreen.selectedItem = locaGrid.selectedItem;
}
And something like the following in your "edit component":
private var _selectedItem:Object;
public function set selectedItem(o:Object):void{
_selectedItem = o;
if (_selectedItem) callLater(updateInputs);
}
public function get selectedItem():Object{
return _selectedItem;
}
private function updateInputs():void{
locaName.text = _selectedItem.NameCol;
locaField.text = _selectedItem.FieldCol;
locaSquare.text = _selectedItem.SquareCol;
}
HTH.
- shaun