RE: [flexcoders] Right click and popup window

2005-10-20 Thread Tracy Spratt
Title: Right click and popup window










Beware of scope issues.

 

Not sure exactly how in your specific case,
but you should probably use a Delegate.  I suspect that handleContext is
running in a scope that is unaware of showFormWin.

 

Tracy

 









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Parekh, Shweta - BLS CTR
Sent: Wednesday, October 19, 2005
5:33 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Right click
and popup window



 

Thanks Jester. I understand the getEditingData() method
better. I got that to work. 

I have a question regarding bringing up a popup window when
you right click, and click on a particular menu option. I got the right click
and creating custom menu by pushing new items working but when I click on a
menu option, I want it to popup a window whereas the app just hangs. 

Here is the code: 
   
import mx.controls.Alert; 
import mx.containers.TitleWindow; 
import mx.managers.PopUpManager; 
  
public var mnuContext:ContextMenu =
null;   
  
public function handleContext( obj, item ):Void 
{   

  if( item.caption == "Yahoo" ) 
 
{   

    obj.txtReport.text =
obj.txtReport.text + "\nYahoo fired.";   
    trace("i am
here"); 
    //var
popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this,
FormulaPopup, true));   
   
    

   
//popupWindow.centerPopUp(this);   

    showFormWin(); 
-- This method is not called at
all, I don't see any trace 
  } 
  else if( item.caption == "Google" ) 
 
{   

    obj.txtReport.text
= obj.txtReport.text + "\nGoogle
fired.";  
  } 
  else if( item.caption == "CNet News" ) 
 
{   

    obj.txtReport.text
= obj.txtReport.text + "\nCNet News
fired.";   

  }  
 }    
 
public function setupContext( Void ):Void 
{  

  mnuContext = new
ContextMenu();   

  mnuContext.hideBuiltInItems(); 
   
  mnuContext.customItems.push( new ContextMenuItem(
"Yahoo", handleContext )
);    
  mnuContext.customItems.push( new ContextMenuItem(
"Google", handleContext )
);    
  mnuContext.customItems.push( new ContextMenuItem(
"CNet News", handleContext )
);    
 
  this["menu"] =
mnuContext;    
  txtReport.text =
"Setup.";    
}    

function showFormWin() 
{   
    trace("showFormWin
fired."); 
    var
popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this,
FormulaPopup, true));     
    

   
popupWindow.centerPopUp(this); 
} 
    
    
   
 

Any help / ideas on this will be appreciated. 

Thanks, 
Shweta 










--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





  




  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











RE: [flexcoders] Right click and popup window

2005-10-21 Thread Parekh, Shweta - BLS CTR
Title: Message





Hi, 

I tried using the Delegate class for the popup but it still does 
not work. It gives me an error saying the property 
being referenced does not have the static attribute. (error on the lines where I 
use createDelegate method) 
I'm working on Flex 
1.5
 
Any 
ideas??
 
http://www.macromedia.com/2003/mxml">      
   import 
mx.controls.Alert;import mx.containers.TitleWindow;import 
mx.managers.PopUpManager;   public var 
mnuContext:ContextMenu = null;   
 public function contextItemPressed( obj, item ):Void 
{    
  if( item.caption == "Yahoo" )   
{    
   obj.txtReport.text = obj.txtReport.text + "\nYahoo 
fired.";    trace("i am here"); //var 
popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, 
FormulaPopup, 
true));//popupWindow.centerPopUp(this);  showFormWin();  
  }   else if( item.caption == "Google" )   
{    
  obj.txtReport.text = obj.txtReport.text + "\nGoogle 
fired.";    } 
  else if( item.caption == "CNet News" )   
{    
  obj.txtReport.text = obj.txtReport.text + "\nCNet News 
fired.";    
  }  
 }    
 public function setupContext( Void ):Void 
{     
mnuContext = new 
ContextMenu();    
  mnuContext.hideBuiltInItems();     var 
contextDelegate = mx.utils.Delegate.createDelegate(this, 
contextItemPressed);   
  mnuContext.customItems.push( new ContextMenuItem( "Yahoo", 
contextDelegate ) 
);      
mnuContext.customItems.push( new ContextMenuItem( "Google", contextDelegate ) 
);      
mnuContext.customItems.push( new ContextMenuItem( "CNet News", contextDelegate ) 
);    
   this["menu"] = 
mnuContext;    
  txtReport.text = "Setup.";    
}    
 
public function 
myContextMenu(){parent.addEventListener("initialize",mx.utils.Delegate.createDelegate(this, 
setupContext));}
 
function 
showFormWin(){  mx.controls.Alert.show("showFormWin fired."); 
 var popupWindow:TitleWindow = 
TitleWindow(PopUpManager.createPopUp(this, FormulaPopup, 
true));popupWindow.centerPopUp(this);}    
      
 Thanks,
Shweta

  
  -Original Message-From: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
  Tracy SprattSent: Thursday, October 20, 2005 1:00 
  PMTo: flexcoders@yahoogroups.comSubject: RE: 
  [flexcoders] Right click and popup window
  
  Beware of scope 
  issues.
   
  Not sure exactly how 
  in your specific case, but you should probably use a Delegate.  I suspect 
  that handleContext is running in a scope that is unaware of 
  showFormWin.
   
  Tracy
   
  
  
  
  
  From: 
  flexcoders@yahoogroups.com 
  [mailto:flexcoders@yahoogroups.com] 
  On Behalf Of Parekh, Shweta - 
  BLS CTRSent: Wednesday, 
  October 19, 2005 5:33 PMTo: 
  flexcoders@yahoogroups.comSubject: [flexcoders] Right click and 
  popup window
   
  Thanks Jester. I 
  understand the getEditingData() method better. I got that to 
  work. 
  I have a question 
  regarding bringing up a popup window when you right click, and click on a 
  particular menu option. I got the right click and creating custom menu by 
  pushing new items working but when I click on a menu option, I want it to 
  popup a window whereas the app just hangs. 
  Here is the 
  code:    
  import 
  mx.controls.Alert; import 
  mx.containers.TitleWindow; import 
  mx.managers.PopUpManager;   
  public var 
  mnuContext:ContextMenu = null;   
    
  public function 
  handleContext( obj, item ):Void {    
    if( 
  item.caption == "Yahoo" )   
  {    
    
    obj.txtReport.text = obj.txtReport.text + 
  "\nYahoo fired.";   
      trace("i am 
  here");     //var 
  popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, 
  FormulaPopup, true));    
      
      
      
  //popupWindow.centerPopUp(this);    
      showFormWin();  
  -- 
  This method is not called at all, I don't see any trace 
    } 
    else if( 
  item.caption == "Google" )   
  {    
      
  obj.txtReport.text = obj.txtReport.text + "\nGoogle 
  fired.";  
    } 
    else if( 
  item.caption == "CNet News" )   
  {    
      
  obj.txtReport.text = obj.txtReport.text + "\nCNet News 
  fired.";    
    
  }   }    
   
  public function 
  setupContext( Void ):Void {   
    mnuContext = 
  new 
  ContextMenu();    
    
  mnuContext.hideBuiltInItems();    
    
  mnuContext.customItems.push( new ContextMenuItem( "Yahoo", handleContext ) 
  );    
    
  mnuContext.customItems.push( new ContextMenuItem( &

RE: [flexcoders] Right click and popup window

2005-10-21 Thread Abdul Qabiz
Title: Message





There is no createDelegate method, it is 
Delegate.create(...)
 
-abdul


From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Parekh, Shweta - BLS 
CTRSent: Friday, October 21, 2005 11:01 AMTo: 
flexcoders@yahoogroups.comSubject: RE: [flexcoders] Right click and 
popup window

Hi, 

I tried using the Delegate class for the popup but it still does 
not work. It gives me an error saying the property 
being referenced does not have the static attribute. (error on the lines where I 
use createDelegate method) 
I'm working on Flex 
1.5
 
Any 
ideas??
 
http://www.macromedia.com/2003/mxml">      
   import 
mx.controls.Alert;import mx.containers.TitleWindow;import 
mx.managers.PopUpManager;   public var 
mnuContext:ContextMenu = null;   
 public function contextItemPressed( obj, item ):Void 
{    
  if( item.caption == "Yahoo" )   
{    
   obj.txtReport.text = obj.txtReport.text + "\nYahoo 
fired.";    trace("i am here"); //var 
popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, 
FormulaPopup, 
true));//popupWindow.centerPopUp(this);  showFormWin();  
  }   else if( item.caption == "Google" )   
{    
  obj.txtReport.text = obj.txtReport.text + "\nGoogle 
fired.";    } 
  else if( item.caption == "CNet News" )   
{    
  obj.txtReport.text = obj.txtReport.text + "\nCNet News 
fired.";    
  }  
 }    
 public function setupContext( Void ):Void 
{     
mnuContext = new 
ContextMenu();    
  mnuContext.hideBuiltInItems();     var 
contextDelegate = mx.utils.Delegate.createDelegate(this, 
contextItemPressed);   
  mnuContext.customItems.push( new ContextMenuItem( "Yahoo", 
contextDelegate ) 
);      
mnuContext.customItems.push( new ContextMenuItem( "Google", contextDelegate ) 
);      
mnuContext.customItems.push( new ContextMenuItem( "CNet News", contextDelegate ) 
);    
   this["menu"] = 
mnuContext;    
  txtReport.text = "Setup.";    
}    
 
public function 
myContextMenu(){parent.addEventListener("initialize",mx.utils.Delegate.createDelegate(this, 
setupContext));}
 
function 
showFormWin(){  mx.controls.Alert.show("showFormWin fired."); 
 var popupWindow:TitleWindow = 
TitleWindow(PopUpManager.createPopUp(this, FormulaPopup, 
true));popupWindow.centerPopUp(this);}    
      
 Thanks,
Shweta

  
  -Original Message-From: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
  Tracy SprattSent: Thursday, October 20, 2005 1:00 
  PMTo: flexcoders@yahoogroups.comSubject: RE: 
  [flexcoders] Right click and popup window
  
  Beware of scope 
  issues.
   
  Not sure exactly how 
  in your specific case, but you should probably use a Delegate.  I suspect 
  that handleContext is running in a scope that is unaware of 
  showFormWin.
   
  Tracy
   
  
  
  
  
  From: 
  flexcoders@yahoogroups.com 
  [mailto:flexcoders@yahoogroups.com] 
  On Behalf Of Parekh, Shweta - 
  BLS CTRSent: Wednesday, 
  October 19, 2005 5:33 PMTo: 
  flexcoders@yahoogroups.comSubject: [flexcoders] Right click and 
  popup window
   
  Thanks Jester. I 
  understand the getEditingData() method better. I got that to 
  work. 
  I have a question 
  regarding bringing up a popup window when you right click, and click on a 
  particular menu option. I got the right click and creating custom menu by 
  pushing new items working but when I click on a menu option, I want it to 
  popup a window whereas the app just hangs. 
  Here is the 
  code:    
  import 
  mx.controls.Alert; import 
  mx.containers.TitleWindow; import 
  mx.managers.PopUpManager;   
  public var 
  mnuContext:ContextMenu = null;   
    
  public function 
  handleContext( obj, item ):Void {    
    if( 
  item.caption == "Yahoo" )   
  {    
    
    obj.txtReport.text = obj.txtReport.text + 
  "\nYahoo fired.";   
      trace("i am 
  here");     //var 
  popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, 
  FormulaPopup, true));    
      
      
      
  //popupWindow.centerPopUp(this);    
      showFormWin();  
  -- 
  This method is not called at all, I don't see any trace 
    } 
    else if( 
  item.caption == "Google" )   
  {    
      
  obj.txtReport.text = obj.txtReport.text + "\nGoogle 
  fired.";  
    } 
    else if( 
  item.caption == "CNet News" )   
  {    
      
  obj.txtReport.text = obj.txtReport.text + "\nCNet News 
  fired.";    
    
  }   }    
   
  public function 
  se

RE: [flexcoders] Right click and popup window

2005-10-21 Thread Parekh, Shweta - BLS CTR
Title: Message





I 
tried this out from sample code given in Flex book - Developing rich clients 
with Macromedia Flex. It does have the 
createDelegate method.
 
-Shweta
 
 

  
  -Original Message-From: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
  Abdul QabizSent: Friday, October 21, 2005 3:12 PMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Right click and 
  popup window
  There is no createDelegate method, it is 
  Delegate.create(...)
   
  -abdul
  
  
  From: flexcoders@yahoogroups.com 
  [mailto:[EMAIL PROTECTED] On Behalf Of Parekh, Shweta - BLS 
  CTRSent: Friday, October 21, 2005 11:01 AMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Right click and 
  popup window
  
  Hi, 
  
  I tried using the Delegate class for the popup but 
  it still does not work. It gives me an error saying 
  the property being referenced does not have the static attribute. (error on 
  the lines where I use createDelegate 
  method) I'm working on Flex 
  1.5
   
  Any 
  ideas??
   
  http://www.macromedia.com/2003/mxml">      
     import 
  mx.controls.Alert;import mx.containers.TitleWindow;import 
  mx.managers.PopUpManager;   public var 
  mnuContext:ContextMenu = null;   
   public function contextItemPressed( obj, item ):Void 
  {    
    if( item.caption == "Yahoo" )   
  {    
     obj.txtReport.text = obj.txtReport.text + "\nYahoo 
  fired.";    trace("i am here"); //var 
  popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, 
  FormulaPopup, 
  true));//popupWindow.centerPopUp(this);  showFormWin();  
    }   else if( item.caption == "Google" )   
  {    
    obj.txtReport.text = obj.txtReport.text + "\nGoogle 
  fired.";    } 
    else if( item.caption == "CNet News" )   
  {    
    obj.txtReport.text = obj.txtReport.text + "\nCNet News 
  fired.";    
    }  
   }    
   public function setupContext( Void ):Void 
  {     
  mnuContext = new 
  ContextMenu();    
    mnuContext.hideBuiltInItems();     var 
  contextDelegate = mx.utils.Delegate.createDelegate(this, 
  contextItemPressed);   
    mnuContext.customItems.push( new ContextMenuItem( "Yahoo", 
  contextDelegate ) 
  );    
    mnuContext.customItems.push( new ContextMenuItem( "Google", 
  contextDelegate ) 
  );    
    mnuContext.customItems.push( new ContextMenuItem( "CNet News", 
  contextDelegate ) 
  );    
     this["menu"] = 
  mnuContext;    
    txtReport.text = 
  "Setup.";    }    
  
   
  public function 
  myContextMenu(){parent.addEventListener("initialize",mx.utils.Delegate.createDelegate(this, 
  setupContext));}
   
  function 
  showFormWin(){  mx.controls.Alert.show("showFormWin 
  fired.");  var popupWindow:TitleWindow = 
  TitleWindow(PopUpManager.createPopUp(this, FormulaPopup, 
  true));popupWindow.centerPopUp(this);}    
        
   Thanks,
  Shweta
  

-Original Message-From: 
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf 
Of Tracy SprattSent: Thursday, October 20, 2005 1:00 
PMTo: flexcoders@yahoogroups.comSubject: RE: 
[flexcoders] Right click and popup window

Beware of scope 
issues.
 
Not sure exactly 
how in your specific case, but you should probably use a Delegate.  I 
suspect that handleContext is running in a scope that is unaware of 
showFormWin.
 
Tracy
 




From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] On Behalf Of Parekh, Shweta - BLS 
CTRSent: Wednesday, 
October 19, 2005 5:33 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Right click and 
popup window
 
Thanks Jester. I 
understand the getEditingData() method better. I got that to 
work. 
I have a question 
regarding bringing up a popup window when you right click, and click on a 
particular menu option. I got the right click and creating custom menu by 
pushing new items working but when I click on a menu option, I want it to 
popup a window whereas the app just hangs. 
Here is the 
code:    
import 
mx.controls.Alert; import 
mx.containers.TitleWindow; import 
mx.managers.PopUpManager;   
public var 
mnuContext:ContextMenu = null;   
  
public function 
handleContext( obj, item ):Void {    
  if( 
item.caption == "Yahoo" )   
{    
  
  obj.txtReport.text = obj.txtReport.text + 
"\nYahoo fired.";   
    trace("i am 
here");     //var 
popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopU

RE: [flexcoders] Right click and popup window

2005-10-21 Thread Abdul Qabiz
Title: Message





That is a mistake, I think.
 
-abdul
 
 


From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On Behalf Of Parekh, Shweta - BLS 
CTRSent: Friday, October 21, 2005 12:19 PMTo: 
flexcoders@yahoogroups.comSubject: RE: [flexcoders] Right click and 
popup window

I 
tried this out from sample code given in Flex book - Developing rich clients 
with Macromedia Flex. It does have the 
createDelegate method.
 
-Shweta
 
 

  
  -Original Message-From: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
  Abdul QabizSent: Friday, October 21, 2005 3:12 PMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Right click and 
  popup window
  There is no createDelegate method, it is 
  Delegate.create(...)
   
  -abdul
  
  
  From: flexcoders@yahoogroups.com 
  [mailto:[EMAIL PROTECTED] On Behalf Of Parekh, Shweta - BLS 
  CTRSent: Friday, October 21, 2005 11:01 AMTo: 
  flexcoders@yahoogroups.comSubject: RE: [flexcoders] Right click and 
  popup window
  
  Hi, 
  
  I tried using the Delegate class for the popup but 
  it still does not work. It gives me an error saying 
  the property being referenced does not have the static attribute. (error on 
  the lines where I use createDelegate 
  method) I'm working on Flex 
  1.5
   
  Any 
  ideas??
   
  http://www.macromedia.com/2003/mxml">      
     import 
  mx.controls.Alert;import mx.containers.TitleWindow;import 
  mx.managers.PopUpManager;   public var 
  mnuContext:ContextMenu = null;   
   public function contextItemPressed( obj, item ):Void 
  {    
    if( item.caption == "Yahoo" )   
  {    
     obj.txtReport.text = obj.txtReport.text + "\nYahoo 
  fired.";    trace("i am here"); //var 
  popupWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, 
  FormulaPopup, 
  true));//popupWindow.centerPopUp(this);  showFormWin();  
    }   else if( item.caption == "Google" )   
  {    
    obj.txtReport.text = obj.txtReport.text + "\nGoogle 
  fired.";    } 
    else if( item.caption == "CNet News" )   
  {    
    obj.txtReport.text = obj.txtReport.text + "\nCNet News 
  fired.";    
    }  
   }    
   public function setupContext( Void ):Void 
  {     
  mnuContext = new 
  ContextMenu();    
    mnuContext.hideBuiltInItems();     var 
  contextDelegate = mx.utils.Delegate.createDelegate(this, 
  contextItemPressed);   
    mnuContext.customItems.push( new ContextMenuItem( "Yahoo", 
  contextDelegate ) 
  );    
    mnuContext.customItems.push( new ContextMenuItem( "Google", 
  contextDelegate ) 
  );    
    mnuContext.customItems.push( new ContextMenuItem( "CNet News", 
  contextDelegate ) 
  );    
     this["menu"] = 
  mnuContext;    
    txtReport.text = 
  "Setup.";    }    
  
   
  public function 
  myContextMenu(){parent.addEventListener("initialize",mx.utils.Delegate.createDelegate(this, 
  setupContext));}
   
  function 
  showFormWin(){  mx.controls.Alert.show("showFormWin 
  fired.");  var popupWindow:TitleWindow = 
  TitleWindow(PopUpManager.createPopUp(this, FormulaPopup, 
  true));popupWindow.centerPopUp(this);}    
        
   Thanks,
  Shweta
  

-Original Message-From: 
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf 
Of Tracy SprattSent: Thursday, October 20, 2005 1:00 
PMTo: flexcoders@yahoogroups.comSubject: RE: 
[flexcoders] Right click and popup window

Beware of scope 
issues.
 
Not sure exactly 
how in your specific case, but you should probably use a Delegate.  I 
suspect that handleContext is running in a scope that is unaware of 
showFormWin.
 
Tracy
 




From: 
flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] On Behalf Of Parekh, Shweta - BLS 
CTRSent: Wednesday, 
October 19, 2005 5:33 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Right click and 
popup window
 
Thanks Jester. I 
understand the getEditingData() method better. I got that to 
work. 
I have a question 
regarding bringing up a popup window when you right click, and click on a 
particular menu option. I got the right click and creating custom menu by 
pushing new items working but when I click on a menu option, I want it to 
popup a window whereas the app just hangs. 
Here is the 
code:    
import 
mx.controls.Alert; import 
mx.containers.TitleWindow; import 
mx.managers.PopUpManager;   
public var 
mnuContext:ContextMenu = null;   
  
public function 
handleContext( obj, item ):Void {    
  if( 
item.caption ==