RE: [flexcoders] Re: Pointers
I did not see a functional similarity to a pointer in actionscript or did I just miss it? All object references in ActionScript are similar to pointers in that they are not the object itself, but references to it. For example, when you declare var textInput1:TextInput = new TextInput(); var textInput2:TextInput = textInput2; you haven't created two TextInput instances; you have made two variables refer to (point to) the same TextInput instance. Gordon Smith Adobe Flex SDK Team From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Dan Pride Sent: Saturday, January 30, 2010 7:11 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Pointers Interesting but not quite the design issue I have in mind. See http://www.danielpride.com/Vehicles3/Vehicles3.html (Its still a little crude, basically playing with the tech. Clicking on a row fills in a series of text boxes. if you edit a box, I want to shift the state just like it does now when you click the new button at the top, except now it will go to an edit state. The idea is you can examine a large data record by selecting it from a row of important fields, then edit if you like or just look. Its easy enough to compare the values field by field but in my old language I would have written a very small function with two pointers (new and old) and then just called the same function in each focus out, passing in the two pointers to the current field of the focus event. This has got to be childs play I would think but newbie status prevents it from popping out of my head I guess. Dan Pride --- On Fri, 1/29/10, jamesfin james.alan.finni...@gmail.com wrote: From: jamesfin james.alan.finni...@gmail.com Subject: [flexcoders] Re: Pointers To: flexcoders@yahoogroups.com Date: Friday, January 29, 2010, 11:51 PM Here's what I've done in the past... // add this in your init code... myDataGrid.addEvent Listener( ListEvent. ITEM_EDIT_ END, editEnd); private function editEnd(evt: DataGridEvent) :void{ // get a reference to the datagrid var grid:DataGrid = evt.target as DataGrid; // get a reference to the name of the property in the // underlying object corresponding to the cell that's being edited var field:String = evt.dataField; // get a reference to the row number (the index in the // dataprovider of the row that's being edited) var row:Number = Number(evt.rowIndex ); // get a reference to the column number of // the cell that's being edited var col:int = evt.columnIndex; if (grid != null){ var oldValue:String = String(grid. dataProvider. getItemAt( row)[field] ); var newValue:String = String(grid. itemEditorInstan ce[grid.columns[ col].editorDataF ield]); var rowData:XML = XML(grid.dataProvid er.getItemAt( row)[0]); // check if the value has changed if (newValue == oldValue){ // nothing has changed... return; } // something has changed... // do something... // you could prevent the change if you want // or do some validation // or just return and the data move on to the dp. } } --- In flexcod...@yahoogro ups.com/mc/compose?to=flexcoders%40yahoogroups.com, Dan Pride danielpride@ ... wrote: Looking for suggestions on how to approach an issue. I want to write a function to compare the current value of a text field with the value of the field in the selected row of the dataGrid. I want to use the function as a focus-out handler on every text input. Obviously I don't want to rewrite this for each and every field but I did not see a functional similarity to a pointer in actionscript or did I just miss it? This is for the awesome Flashbuilder 4,... I have a text input for every field in the value object and want to compare each to the selectedItem for the dataGrid and kick some stuff if it does not match. Thanks Dan Pride
[flexcoders] Re: Pointers
I have some code which lets you call a function on focus out or enter for every changed item and then do post processing...but its far too big to post and not sure how to put it on the yahoo group... Web Admin FlexDownloads.com --- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote: Here's what I've done in the past... // add this in your init code... myDataGrid.addEventListener(ListEvent.ITEM_EDIT_END, editEnd); private function editEnd(evt:DataGridEvent):void{ // get a reference to the datagrid var grid:DataGrid = evt.target as DataGrid; // get a reference to the name of the property in the // underlying object corresponding to the cell that's being edited var field:String = evt.dataField; // get a reference to the row number (the index in the // dataprovider of the row that's being edited) var row:Number = Number(evt.rowIndex); // get a reference to the column number of // the cell that's being edited var col:int = evt.columnIndex; if (grid != null){ var oldValue:String = String(grid.dataProvider.getItemAt(row)[field]); var newValue:String = String(grid.itemEditorInstance[grid.columns[col].editorDataField]); var rowData:XML = XML(grid.dataProvider.getItemAt(row)[0]); // check if the value has changed if (newValue == oldValue){ // nothing has changed... return; } // something has changed... // do something... // you could prevent the change if you want // or do some validation // or just return and the data move on to the dp. } } --- In flexcoders@yahoogroups.com, Dan Pride danielpride@ wrote: Looking for suggestions on how to approach an issue. I want to write a function to compare the current value of a text field with the value of the field in the selected row of the dataGrid. I want to use the function as a focus-out handler on every text input. Obviously I don't want to rewrite this for each and every field but I did not see a functional similarity to a pointer in actionscript or did I just miss it? This is for the awesome Flashbuilder 4,... I have a text input for every field in the value object and want to compare each to the selectedItem for the dataGrid and kick some stuff if it does not match. Thanks Dan Pride
Re: [flexcoders] Re: Pointers
Interesting but not quite the design issue I have in mind. See http://www.danielpride.com/Vehicles3/Vehicles3.html (Its still a little crude, basically playing with the tech. Clicking on a row fills in a series of text boxes. if you edit a box, I want to shift the state just like it does now when you click the new button at the top, except now it will go to an edit state. The idea is you can examine a large data record by selecting it from a row of important fields, then edit if you like or just look. Its easy enough to compare the values field by field but in my old language I would have written a very small function with two pointers (new and old) and then just called the same function in each focus out, passing in the two pointers to the current field of the focus event. This has got to be childs play I would think but newbie status prevents it from popping out of my head I guess. Dan Pride --- On Fri, 1/29/10, jamesfin james.alan.finni...@gmail.com wrote: From: jamesfin james.alan.finni...@gmail.com Subject: [flexcoders] Re: Pointers To: flexcoders@yahoogroups.com Date: Friday, January 29, 2010, 11:51 PM Here's what I've done in the past... // add this in your init code... myDataGrid.addEvent Listener( ListEvent. ITEM_EDIT_ END, editEnd); private function editEnd(evt: DataGridEvent) :void{ // get a reference to the datagrid var grid:DataGrid = evt.target as DataGrid; // get a reference to the name of the property in the // underlying object corresponding to the cell that's being edited var field:String = evt.dataField; // get a reference to the row number (the index in the // dataprovider of the row that's being edited) var row:Number = Number(evt.rowIndex ); // get a reference to the column number of // the cell that's being edited var col:int = evt.columnIndex; if (grid != null){ var oldValue:String = String(grid. dataProvider. getItemAt( row)[field] ); var newValue:String = String(grid. itemEditorInstan ce[grid.columns[ col].editorDataF ield]); var rowData:XML = XML(grid.dataProvid er.getItemAt( row)[0]); // check if the value has changed if (newValue == oldValue){ // nothing has changed... return; } // something has changed... // do something... // you could prevent the change if you want // or do some validation // or just return and the data move on to the dp. } } --- In flexcod...@yahoogro ups.com, Dan Pride danielpride@ ... wrote: Looking for suggestions on how to approach an issue. I want to write a function to compare the current value of a text field with the value of the field in the selected row of the dataGrid. I want to use the function as a focus-out handler on every text input. Obviously I don't want to rewrite this for each and every field but I did not see a functional similarity to a pointer in actionscript or did I just miss it? This is for the awesome Flashbuilder 4,... I have a text input for every field in the value object and want to compare each to the selectedItem for the dataGrid and kick some stuff if it does not match. Thanks Dan Pride
[flexcoders] Re: Pointers
Here's what I've done in the past... // add this in your init code... myDataGrid.addEventListener(ListEvent.ITEM_EDIT_END, editEnd); private function editEnd(evt:DataGridEvent):void{ // get a reference to the datagrid var grid:DataGrid = evt.target as DataGrid; // get a reference to the name of the property in the // underlying object corresponding to the cell that's being edited var field:String = evt.dataField; // get a reference to the row number (the index in the // dataprovider of the row that's being edited) var row:Number = Number(evt.rowIndex); // get a reference to the column number of // the cell that's being edited var col:int = evt.columnIndex; if (grid != null){ var oldValue:String = String(grid.dataProvider.getItemAt(row)[field]); var newValue:String = String(grid.itemEditorInstance[grid.columns[col].editorDataField]); var rowData:XML = XML(grid.dataProvider.getItemAt(row)[0]); // check if the value has changed if (newValue == oldValue){ // nothing has changed... return; } // something has changed... // do something... // you could prevent the change if you want // or do some validation // or just return and the data move on to the dp. } } --- In flexcoders@yahoogroups.com, Dan Pride danielpr...@... wrote: Looking for suggestions on how to approach an issue. I want to write a function to compare the current value of a text field with the value of the field in the selected row of the dataGrid. I want to use the function as a focus-out handler on every text input. Obviously I don't want to rewrite this for each and every field but I did not see a functional similarity to a pointer in actionscript or did I just miss it? This is for the awesome Flashbuilder 4,... I have a text input for every field in the value object and want to compare each to the selectedItem for the dataGrid and kick some stuff if it does not match. Thanks Dan Pride