Solved

rendering popup to left or right

Posted on 2011-09-14
10
166 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now