Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

rendering popup to left or right

Posted on 2011-09-14
10
Medium Priority
?
177 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
Choose an Exciting Career in Cybersecurity

Help prevent cyber-threats and provide solutions to safeguard our global digital economy. Earn your MS in Cybersecurity. WGU’s MSCSIA degree program was designed in collaboration with national intelligence organizations and IT industry leaders.

 
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 600 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 600 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

[Video] Create a Disruption-Free Workspace

Open offices have their challenges. And Sometimes, it's even hard to work at work. It's time to reclaim your office and create a disruption-free workspace. With the MB 660, you can:

-Increase Concentration
-Improve well-being
-Boost Productivity

Question has a verified solution.

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

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…
Did you know there are services out there that can turn an Instagram feed into an RSS feed? I found some interesting exclusive Instagram content which I wanted to follow without signing up for yet another social media account. RSS to the rescue!
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 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