Chris--here is a snippet of code that I use to center my windows:
private function showActivationFormTitleWindow():void {
var newWindow:ActivationCodeTitleWindow =
ActivationCodeTitleWindow(PopUpManager.createPopUp( this,
ActivationCodeTitleWindow , true));
centerWindow( newWindow );
}
private function centerWindow( window:TitleWindow ):void {
// Calculate position of TitleWindow in Application's
coordinates.
var curLoc:Point = new Point(0, 0);
var relocPoint:Point = parentDocument.localToGlobal( curLoc );
relocPoint.x += parentApplication.width/2 - window.width/2;
//we might be in a scroll window, so use the parents
height instead of our own
relocPoint.y += parentApplication.height/2 - window.height/2;
window.move( relocPoint.x, relocPoint.y );
}
On Mon, Aug 23, 2010 at 10:00 PM, Chris H <[email protected]> wrote:
> I have window W1 which has a Vertical Box which in turn has a Datagrid and
> one of those DataGrid columns of the Datagrid has a Horizontal Box which has
> a button icon. The MXML is somewhat like
>
> <mx:VBox width="100%" paddingBottom="10" paddingLeft="10" paddingRight="10"
> paddingTop="10" styleName="formSection">
> <mx:DataGrid id="my_grid" dataProvider="{my_grid_dp}"
> headerHeight="0" width="100%"
> allowMultipleSelection="true" change="remove_value.enabled =
> expected_result_grid.selectedItems.length > 0;" rowCount="3">
> <mx:columns>
> <mx:DataGridColumn headerText="Column 1"
> dataField="expected_result" wordWrap="true" />
>
> <mx:DataGridColumn headerText="Column 2"
> dataField="expected_result" width="45" >
> <mx:itemRenderer>
> <mx:Component>
> <mx:HBox horizontalAlign="center">
> <mx:Button
> icon="@Embed('../assets/img/edit.png')" toolTip="View" buttonMode="true"
> click="outerDocument.openmyWin_fn('update')"/>
> </mx:HBox>
> </mx:Component>
> </mx:itemRenderer>
> </mx:DataGridColumn>
>
> </mx:columns>
> </mx:DataGrid>
>
> </mx:VBox>
>
> When the button icon is clicked(which is noted in bold above), another new
> window W2 is opened using the below function
>
> public function openmyWin_fn(eventObj:*):void
> {
> //Keeps multiple windows from being opened
> if(result_win == null){
> result_win = PopUpManager.createPopUp(this, result_win,
> true) as result_win;
> }
>
> //Passes the parent object to the popup window
> result_win.openingParentWindow = this;
>
> //Set the mode (Add or Update) in which the form should
> operate
> result_win.form_mode = eventObj;
>
> }
>
> I tried to add a TextInput in the above MXML in Window W1's source which led
> to the window W2 opening in the rightmost part of browser window without a
> scroll bar instead of appearing with a scroll bar in the center of browser
> window. W2 should be appearing as overlapping W1, not adjacent to it.
>
> I commented the TextInput I added, even removed it, still the issue(window
> W2 opening in the rightmost part of browser window without a scroll bar)
> persists.
>
> I once had this where inadvertently a height value was added to the whole
> window. After I removed it, the window was fine. This time I am using
> comparing the source before I added the TextInput control and after and it
> looks same.
>
> Where could I be erring to cause the W2 to appear in the rightmost part of
> browser?
>
> Any suggestions would be appreciated.
>
>
>
>
> -------------------------------------------------------------
> To unsubscribe from this list, simply email the list with unsubscribe in the
> subject line
>
> For more info, see http://www.affug.com
> Archive @ http://www.mail-archive.com/discussion%40affug.com/
> List hosted by FusionLink
> -------------------------------------------------------------
--
Scott Talsma
CTO, echoEleven
-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the
subject line
For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------