http://livedocs.macromedia.com/flex/2/langref/mx/containers/TitleWindow.html
the sample show how to pass a ref to the titlewindow.
DK
On 8/20/06, Barry Beattie <[EMAIL PROTECTED]> wrote:
I'm not sure how to do this:
I have an ItemRenderer that has a textbox and a "look-up" button to
open a modal TitleWindow for a full search.
This will do remote calls to get data, where the user selects what
they want (checkboxes) and the chosen "loginName" fields appended to
itemRenderers text box.
the thing that's doing my head in is the best way to get a reference
back to the parent to _append_ the selections
any suggestions?
thanx
barry.b
*************
itemRenderer (parent)
*************
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml ">
<mx:Script>
<![CDATA[
import mx.controls.DataGrid;
import mx.events.FlexEvent;
import mx.managers.PopUpManager;
import mx.core.IFlexDisplayObject;
import mx.containers.TitleWindow;
private function showSearch():void {
var searchWindow:TitleWindow =
TitleWindow( PopUpManager.createPopUp(this
, AcademicSearchForm, true));
searchWindow.title="Enter Academic Surname";
searchWindow.showCloseButton=true ;
}
[Bindable]
public var newAcademic:String = new String();
]]>
</mx:Script>
<mx:TextInput id="AcademicText" text="{newAcademic}" />
<mx:Button id="SearchAcademicBtn" label="Look-up"
click="showSearch();" />
</mx:HBox>
***************
modal search window (titleWindow)
***************
<?xml version="1.0"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="doInit();"
showCloseButton="true"
close="removeMe()"
>
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
private var AcademicSearchResults:Array = new Array(
{surname: null, firstname: null, loginName: null}
);
private function removeMe():void {
// Put any clean-up code here.
PopUpManager.removePopUp(this);
}
private function doInit():void {
PopUpManager.centerPopUp(this);
SearchResultsDG.visible = false;
}
private function processSearch():void {
// show "waiting" indicator...
clearSearchResults();
getSearchResults();
SearchResultsDG.visible = true;
SearchResultsDG.dataProvider = AcademicSearchResults;
}
private function getSearchResults():void{
// REPLACE THIS WITH REMOTE CALLS
AcademicSearchResults = new Array(
{surname: 'aaa', firstname: 'bbb', loginName: 'aaab'}
, {surname: 'ccc', firstname: 'ddd', loginName: 'cccd'}
, {surname: 'eee', firstname: 'fff', loginName: 'eeef'}
);
}
private function clearSearchResults():void{
AcademicSearchResults = new Array(
{surname: null, firstname: null, loginName: null}
);
SearchResultsDG.visible = false;
}
private function finaliseResults():void{
/* HERE:
take what was selected with "useChoice" checkboxes and
_append_ the loginName fields as a list back to the
parent itemRenderer control
*/
removeMe();
}
]]>
</mx:Script>
<mx:Form>
<mx:FormItem label="Surname">
<mx:TextInput id="surname" width="100%"/>
</mx:FormItem>
</mx:Form>
<mx:VBox>
<mx:HBox>
<mx:Button click="processSearch();" label="Search"/>
<mx:Button click="finaliseResults()" label="Done"/>
</mx:HBox>
<mx:DataGrid id="SearchResultsDG">
<mx:columns>
<mx:DataGridColumn headerText="surname" dataField="surname"/>
<mx:DataGridColumn headerText="firstname" dataField="firstname"/>
<mx:DataGridColumn headerText="loginName" dataField="loginName"/>
<mx:DataGridColumn headerText="Use">
<mx:itemRenderer>
<mx:Component>
<mx:HBox horizontalAlign="center">
<mx:Script>
<![CDATA[
[Bindable]
public var selected:Boolean;
]]>
</mx:Script>
<mx:CheckBox id="useChoice" selected="false" click="selected =
useChoice.selected"/>
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:TitleWindow>
****************************************
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it? __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Software development tool | Software development | Software development services |
| Home design software | Software development company |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___

