Solved

rendering popup to left or right

Posted on 2011-09-14
10
170 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

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…
This article summaries thoughts and ideas from two years of sustained use. It provides good reasoning to make the jump to Windows 10.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 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