Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

rendering popup to left or right

Posted on 2011-09-14
10
Medium Priority
?
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
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

Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

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…
Check out what's been happening in the Experts Exchange community.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

721 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