Solved

rendering popup to left or right

Posted on 2011-09-14
10
169 Views
Last Modified: 2012-05-12
hi guys
This is my popup code

PopUpManager.addPopUp(TradeLookUp.dataGrid, this, false);
PopUpManager.centerPopUp(TradeLookUp.dataGrid);

Is there a way i can display the popup to the left or right of the window?
0
Comment
Question by:royjayd
  • 4
  • 3
  • 3
10 Comments
 
LVL 14

Expert Comment

by:tomaugerdotcom
ID: 36543590
Is the PopupManager your own class, or is it some third party library. If it's a third party library, can you provide a link to the source or docs?
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36543987
"TradeLookUp.dataGrid" is Class type?

Why you cannot move the parent window?

var window:TradeLookUp = PopUpManager.addPopUp(TradeLookUp, this, false)  as TradeLookUp
PopUpManager.centerPopUp(window);

window.dataGrid.x = 0;
window.dataGrid.y = 0;

or

window.x = 0;
window.y = 0;
0
 

Author Comment

by:royjayd
ID: 36545217
My TradeLookUp  goes like

public class TradeLookUp  extends HBox  
{
public var dataGrid : DataGrid;
public var searchText : mx.controls.TextInput = new TextInput(); //searchText used for key_up in grid
public function gridFilterHandler () : void {
if (!dataGrid){
dataGrid = new DataGrid();
dataGrid.x = searchText.x;
dataGrid.y = searchText.y + searchText.height;
dataGrid.width = componentWidth;
dataGrid.includeInLayout = false; //false;
dataGrid.maxHeight = 200;
createDataGridColumns();
}
this.addChild( dataGrid );
}
}

TradeLookUp is called like this :

private function buildColumnModel(complexheaders:Object,fields:Object):void{
dataGrid.addEventListener(flash.events.KeyboardEvent.KEY_UP,showDatagrid);
}
private function showDatagrid(event: flash.events.KeyboardEvent) : void {      
var tradeLookUp : TradeLookUp = new TradeLookUp() ;      
tradeLookUp.searchText.text = event.target.text;  
tradeLookUp.searchText.x = 0;
tradeLookUp.searchText.y = 0;                  
tradeLookUp.x = 0;
tradeLookUp.y = 0;
tradeLookUp.componentWidth=200;
tradeLookUp.maxDataGridHeight=250;
tradeLookUp.gridFilterHandler(); //call tradeLookup      
            
//PopUpManager.addPopUp(tradeLookUp.dataGrid, this, false); //popup the grid
//PopUpManager.centerPopUp(tradeLookUp.dataGrid); //i dont want to center the popup
                  
var window:TradeLookUp  = PopUpManager.addPopUp(TradeLookUp, this, false)  as TradeLookUp //new code
PopUpManager.centerPopUp(window);
window.dataGrid.x = 0;
window.dataGrid.y = 0;
                  
}            
                        
My goal is i want to display the poup window to the left of searchText box in the dataGrid

Right now i get an error on this line
var window:TradeLookUp  = PopUpManager.addPopUp(TradeLookUp, this, false)  as TradeLookUp
implicit coercion of a value of type class to an unrelated type IFlexDisplayObject

0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 14

Expert Comment

by:tomaugerdotcom
ID: 36550136
In your code:
var window:TradeLookUp  = PopUpManager.addPopUp(TradeLookUp, this, false)  as TradeLookUp

Open in new window

you're passing the class instead of an instance of the class.
So one of your earlier lines is closer to the mark:
PopUpManager.addPopUp(tradeLookUp.dataGrid, this, false);

Open in new window


0
 
LVL 14

Expert Comment

by:tomaugerdotcom
ID: 36550162
The problem with PopupManager as far as I can tell is that addPopUp doesn't return a reference to the container that is going to hold your TradeLookUp instance.

Can you use your reference to tradeLookUp, once you have added the popup, to get a reference to its parent display list items that you could then position using their .x and .y properties?

trace(tradeLookUp.parent.parent + "." + tradeLookUp.parent);

Open in new window


Sometimes in Flex you have to go up a few parents to get at the displayList items you're actually interested in.
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36552994
Why inside TradeLookUp.as you are trying creating the same window?

//PopUpManager.addPopUp(tradeLookUp.dataGrid, this, false); //popup the grid
//PopUpManager.centerPopUp(tradeLookUp.dataGrid); //i dont want to center the popup
                 
var window:TradeLookUp  = PopUpManager.addPopUp(TradeLookUp, this, false)  as TradeLookUp //new code
PopUpManager.centerPopUp(window);
window.dataGrid.x = 0;
window.dataGrid.y = 0;




What is your idea?
0
 

Author Comment

by:royjayd
ID: 36554148
ok let me give a simple example

I have a datagrid like this one  (image attached)

When user start typing a name in the 'Name' box a smaller datagrid pops up which contains the name and id.

Right now the smaller datagrid is poping up in the center like this
PopUpManager.addPopUp(smallerDataGrid, this, false);                   
PopUpManager.centerPopUp(smallerDataGrid);

My requirment is that smallerDataGrid  should popup right next to the name box.
So i think i would need to know the 'x' and 'y' information and pass it to PopUpManager.
but not sure

Thx. datagrid datagrid
0
 
LVL 29

Accepted Solution

by:
dgofman earned 150 total points
ID: 36555566
Is not good idea inside one PopupManager children open another one and pass self instance type. If user will click on "smallerDataGrid" datagrid are you planing to open another popup with "child of smallerDataGrid" etc.?
0
 

Author Comment

by:royjayd
ID: 36559995
>>>If user will click on "smallerDataGrid" datagrid are you planing to open another popup with "child of smallerDataGrid" etc.?

No.  Its only one level.

Is there anyway i can pass 'x' and 'y' to popupmanager? or open the popup at specific 'x' and 'y' position?

thanks
0
 
LVL 14

Assisted Solution

by:tomaugerdotcom
tomaugerdotcom earned 150 total points
ID: 36560033
No, PopupManager doesn't take x and y coordinates. Your best best, like I said, is to query the element that's inside the popup (that you DO have a reference to), and traverse its displaylist hierarchy to get to an element that you CAN position. Should be quite straightforward.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
flex 4.5 upload with java servlet 1 1,063
Converting PDF to SWF with video embedded 11 458
Flash builder 101 tutorial 3 439
Dashboard Examples 1 585
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question