Not sure if many people have dealt w/ non-Title Window pop ups.  I'm working on a search pop-up for our app and a plain TitleWindow won't cut it since we need to have links on the header and be able to stretch out a screen from the right side of the window.  So, I have a Canvas that contains a TitleWindow.  Anyway, I would like to be able to drag a selection from a grid within the Canvas popUp to a grid within the parent component, but I can't seem to get it to work.   I've included sample code in the body of this e-mail - to make it work just copy the "Custom Pop Up" code into a file named CustomPopUp.mxml and place the test app and the CustomPopUp in the same directory.  If anyone can also figure out how to get the search window to appear correctly (the background is invisible), figure out how to get the window to be draggable and allow for the popUp to be closed I'd greatly appreciate it.
 
Thanks,
 
Jaime
 
<!-- Test App -->

<?xml version="1.0" encoding="UTF-8"?>
<mx:Application pageTitle="Canvas Test" width="100%" height="100%" xmlns:mx=" http://www.macromedia.com/2003/mxml" creationComplete="populatePersonGrid();">
 <mx:Script>
 <![CDATA[
 import mx.managers.DragManager;
 import CustomPopUp;
 
 var popUpWindow;
 var peopleList:Array;
 
 function addPersonClick(event) {
  this.popUpWindow = mx.managers.PopUpManager.createPopUp(this, CustomPopUp, true);
 }
 
 function populatePersonGrid() {
  peopleList = new Array({LASTNAME:"Doe", FIRSTNAME:"John", SSN:1433},
              {LASTNAME:"Doe", FIRSTNAME:"Jane", SSN:1323});
 }
 
 public function doDragEnter(event):Void{
  // allow drop
  event.handled=true;
  // set action to copy
  event.action="" ;
 }
 
 public function doDragDrop(event):Void{
  dgPeople.dataProvider.addItem(event.target.selectedItem);
 }
 ]]>
 </mx:Script>

 <mx:Link id="lblObjectAddLnk" label="Add Person" color="blue" click="addPersonClick(event);"/>
 <mx:DataGrid id="dgPeople" dataProvider="{peopleList}" width="300" height="500">
  <mx:columns>
   <mx:Array>
     <mx:DataGridColumn headerText="Last Name" columnName="LASTNAME"/>
    <mx:DataGridColumn headerText="First Name" columnName="FIRSTNAME"/>
    <mx:DataGridColumn headerText="SSN (Last 4)" columnName="SSN"/>
   </mx:Array>
  </mx:columns>
 </mx:DataGrid>
</mx:Application>

<!-- Custom Pop Up -->

<?xml version="1.0" encoding="utf-8" ?>
<mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml" width="400" height="400" creationComplete="populateSearchResults();">

 <mx:Script>
 <![CDATA[
   var searchResult:Array;
   
   function populateSearchResults() {
    searchResult = new Array({LASTNAME:"McDonald", FIRSTNAME:"Ronald", SSN:7833},
                 {LASTNAME:"Duck", FIRSTNAME:"Donald", SSN:9877});
   }
   
   function searchClick() {
    // make search window invisible
    toggleSearchView();
   }
    
   function toggleSearchView() {
    filterPrsnPopSearch.visible = !filterPrsnPopSearch.visible;
   }
      
   function clear() {
    txtSrchLastName.text = "";
    txtSrchFirstName.text = "";
    txtSrchSalesCode.text = "";
   }
   
   function restoreMyHeight(event) {
    event.target.height="100%";
   }   
 ]]>
 </mx:Script>
 <!-- Styles -->
 <mx:Style>
  .linkStyle {color: Blue}
  .filter  {background-color: #f0f0f0;
       margin-left: 8;
       margin-right: 8;
       margin-top: 4;
       margin-bottom: 4;
       border-style: solid;
       border-thickness: 1;
       border-color: #b8bfbe;
       border-sides: bottom;}
 </mx:Style>
 <!-- Resize effect for the preview panel -->
 <mx:Effect>
  <mx:Resize name="srchPrsnPopOpenSize" widthFrom="0" widthTo="275" suspendBackgroundProcessing="true"/>
  <mx:Resize name="srchPrsnPopCloseSize" widthFrom="275" widthTo="0" suspendBackgroundProcessing="true"/>
 </mx:Effect>
 
  <mx:TitleWindow id="wndwPayeeSrch" width="100%" height="100%" title="Person Search" closeButton="true"> 
  <mx:DataGrid id="dgPeople" dataProvider="{searchResult}" rowCount="{searchResult.length}" dragEnabled="true" width="100%" height="100%">
    <mx:columns>
    <mx:Array>
      <mx:DataGridColumn columnName="LASTNAME" headerText="Last Name"/>
      <mx:DataGridColumn columnName="FIRSTNAME" headerText="First Name"/> 
      <mx:DataGridColumn columnName="SSN" headerText="SSN" width="75"/>
    </mx:Array>
    </mx:columns>
  </mx:DataGrid>
 </mx:TitleWindow>
 <!-- These links will go over the header of the title window -->
  <mx:HBox width="100%" verticalAlign="bottom" horizontalAlign="right" marginRight="35" marginTop="6">
    <mx:Link id="lnkShowAll" label="Show All" styleName="linkStyle" toolTip="In production, this will show all people."/>
    <mx:Link id="lnkSearchOptions" label="Search Options" click="toggleSearchView();" styleName="linkStyle" toolTip="Click to toggle search window visibility."/>
  </mx:HBox>
 <!-- This search window should be aligned to the right of the title window -->
 <mx:Box id="filterPrsnPopSearch" styleName="filter" x="{wndwPayeeSrch.x + wndwPayeeSrch.width }" width="0" height="100%" visible="false" showEffect="srchPrsnPopOpenSize" hideEffect="srchPrsnPopCloseSize" effectEnd="restoreMyHeight(event);">
  <mx:FormItem label="Last Name" labelWidth="75">
   <mx:TextInput id="txtSrchLastName" toolTip="Enter all or the first few characters of the person's last name"/>
  </mx:FormItem>
  <mx:FormItem label="First Name" labelWidth="75">
   <mx:TextInput id="txtSrchFirstName" toolTip="Enter all or the first few characters of the person's first name"/>
  </mx:FormItem>
  <mx:FormItem label="SSN" labelWidth="75">
   <mx:TextInput id="txtSrchSalesCode" toolTip="Enter all or the first few characters of the person's sales code"/>
  </mx:FormItem>
  <mx:HBox width="100%" horizontalAlign="right">
   <mx:Button id="btnClear"  label="Clear" click="clear();"/>
   <mx:Button id="btnSearch" label="Search" click="searchClick();"/>
  </mx:HBox>
 </mx:Box>
</mx:Canvas>



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




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to