Find below an exemple:
<?xml version="1.0" encoding="utf-8"?>
<windowSkin:wCustomWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
skinClass="fr.isoe.ui.windowSkin.CustomWindowSkin"
resizable="true"
creationComplete="wcustomwindow1_creationCompleteHandler(event)"
xmlns:windowSkin="fr.isoe.ui.windowSkin.*"
minWidth="400" minHeight="300"
width="400" height="300"
resize="wcontact_resizeHandler(event)"
xmlns:customNavTab="fr.isoe.component.customNavTab.*"
xmlns:componentGlob="fr.isoe.ui.componentGlob.*">
<fx:Declarations>
<!-- Placer ici les éléments non visuels (services et objets de valeur, par exemple). -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import fr.isoe.config.urlManager;
import fr.isoe.ui.componentGlob.IconManager;
import fr.isoe.util.FileSerializer;
import fr.isoe.util.UserPrefs;
import fr.isoe.util.windowPlace;
import fr.kapit.flex.ui.spark.loginBox.RetrievePasswordSkin;
import mx.controls.Button;
import mx.events.FlexEvent;
import mx.events.ItemClickEvent;
import mx.events.ResizeEvent;
import mx.rpc.events.FaultEvent;
private var pg:UserPrefs;
private var glossObject:Object={label:"Glossaire", icon:IconManager.bhGlossaire};
private var allObject:Object={label:"Tout Afficher", icon : IconManager.bhAll};
private var searchObject:Object={label:"Rechercher", icon : IconManager.bhSearch};
private var triObject:Object = {label:"Trier", icon : IconManager.bhChart};
private var printObject:Object={label:"Imprimer", icon : IconManager.bhPrint};
private var plusObject:Object={label:"Ajouter", icon : IconManager.bhAdd};
private var editObject : Object = {label:"Editer", icon:IconManager.bhEdit};
private var trashObject:Object={label:"Supprimer", icon : IconManager.bhTrash};
private var delObject:Object = {label:"Fermer", icon : IconManager.bhDel};
private var validObjet:Object = {label:"Valider", icon : IconManager.bhValid};
[bindable]
public var buttons:Array = [glossObject, allObject, searchObject,triObject, printObject, plusObject,editObject, trashObject, delObject, validObjet];
private var _selectedPatient:String;
private var _patientNomPrenom : String;
private var _patientNaissance:String;
private var dpContactPat:XMLList;
protected function changeBbHandler(event:ItemClickEvent):void
{
var selection:int = event.index;
trace ("index " +selection);
switch(selection)
{
// affichage des formulaires à coder
case 7:
{
closeMyWindow();
break;
}
case 8:
{
closeMyWindow();
break;
}
}
}
private function closeMyWindow():void
{
stage.nativeWindow.dispatchEvent(new Event("myEventClose", true));
stage.nativeWindow.close();
}
private function onMyEventClose(e:Event):void
{
pg = new UserPrefs();
this.pg.appPosX = stage.nativeWindow.x;
this.pg.appPosY = stage.nativeWindow.y;
this.pg.appWidth = stage.nativeWindow.width;
this.pg.appHeight = stage.nativeWindow.height;
FileSerializer.writeObjectToFile(this.pg, "prefNotesPat.up");
}
private function serviceFault(event:FaultEvent):void
{
trace("Erreur "+ event.fault.message);
}
protected function wcustomwindow1_creationCompleteHandler(event:FlexEvent):void
{
this.titleDisplay.text = "Liste des Contacts";
// suite lancement
stage.nativeWindow.addEventListener("myEventClose",onMyEventClose);
var pos:windowPlace = new windowPlace("prefNotesPat.up");
stage.nativeWindow.x = pos.windowX;
stage.nativeWindow.y = pos.windowY;
stage.nativeWindow.height = pos.windowH;
stage.nativeWindow.width = pos.windowW;
mainConteneur.left = 7;
mainConteneur.right = 7;
mainConteneur.top = 5;
mainConteneur.percentWidth = 100;
mainConteneur.percentHeight = 100;
/* trace("mainConteneur" + mainConteneur.width+"/"+this.width);
trace("stage" + stage.nativeWindow.width); */
// inactive le bouton fermer
Button(tbbAction.getChildAt(0)).enabled = false;
Button(tbbAction.getChildAt(1)).enabled = false;
Button(tbbAction.getChildAt(2)).enabled = false;
Button(tbbAction.getChildAt(3)).enabled = false;
Button(tbbAction.getChildAt(4)).enabled = false;
Button(tbbAction.getChildAt(5)).enabled = false;
Button(tbbAction.getChildAt(6)).enabled = false;
var urlPat : urlManager = new urlManager();
//phpPatientService.url = urlPat.urlService()+"35LoadNotesA.php";
}
public function get selectedPatient():String
{
return _selectedPatient;
}
public function set selectedPatient(value:String):void
{
_selectedPatient = value;
}
public function get patientNomPrenom():String
{
return _patientNomPrenom;
}
public function set patientNomPrenom(value:String):void
{
_patientNomPrenom = value;
}
public function get patientNaissance():String
{
return _patientNaissance;
}
public function set patientNaissance(value:String):void
{
_patientNaissance = value;
}
protected function wcontact_resizeHandler(event:ResizeEvent):void
{
// TODO Auto-generated method stub
this.updateDisplayList(this.width, this.height);
}
]]>
</fx:Script>
<s:VGroup id="mainConteneur" left="7" right="7" top="5" bottom="0" horizontalAlign="center"
paddingBottom="0" paddingLeft="10" paddingRight="10" >
<s:HGroup width="100%" height="53" id="titleWin">
<s:Image x="0" y="0" width="53" height="53" />
<s:VGroup width="40%">
<s:HGroup width="100%" height="50%"> <!-- Nom prenom-->
<s:Label text="{_patientNomPrenom}" id="lNomPrenom" fontWeight="bold"/>
</s:HGroup>
<s:HGroup width="100%" height="50%"> <!-- Naissance-->
<s:Label text="{_patientNaissance}" id="lNaissance" />
</s:HGroup>
</s:VGroup>
<s:VGroup width="40%"> <!-- Modif-->
<s:Label id="ldhCrea"
textAlign="left" styleName="dataCreaModif"/>
<s:Label id="ldhModif"
textAlign="left" styleName="dataCreaModif"/>
</s:VGroup>
</s:HGroup>
<s:Group height="100%" width="100%">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<!-- partie centrale-->
<s:DataGrid id="dgContactPat" width="100%" height="100%"
editable="false" fontWeight="normal">
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="ctId" headerText="" sortDescending="false" width="15" visible="false"/>
<s:GridColumn dataField="ctRelation" headerText="Relation" sortDescending="false" />
<s:GridColumn dataField="ctNom" headerText="Correspondant" sortDescending="false" />
<s:GridColumn dataField="ctSpec" headerText="Spécialité" sortDescending="false" />
<s:GridColumn dataField="ctTel" headerText="Tél" sortDescending="false" />
<s:GridColumn dataField="ctFax" headerText="Fax" sortDescending="false" />
<s:GridColumn dataField="ctCP" headerText="CP" sortDescending="false" />
<s:GridColumn dataField="ctVille" headerText="Ville" sortDescending="false" />
<s:GridColumn dataField="ctadr" headerText="Adr" sortDescending="false" visible="false"/>
<s:GridColumn dataField="ctMail" headerText="Mail" sortDescending="false" visible="false"/>
<s:GridColumn dataField="ctNote" headerText="Notes" sortDescending="false" visible="false"/>
</s:ArrayList>
</s:columns>
</s:DataGrid>
<s:HGroup width="100%">
<s:Label text="Adresse"/>
<mx:Text text ="{dgContactPat.selectedItem.ctadr}"/>
</s:HGroup>
<customNavTab:IconToggleButtonBar id="tbbAction" height="30"
dataProvider="{buttons}"
itemClick="changeBbHandler(event)" labelPlacement="bottom"
paddingBottom="2" selectedIndex="-1" toggleOnClick="false"
horizontalAlign="center"
bottom="3"
width="100%"/>
</s:Group>
</s:VGroup>
</windowSkin:wCustomWindow>
Le 27/12/11 16:09, claudiu ursica a écrit :
Can you show some code?C
From: Isabelle Loyer Perso <isa_loyer@yahoo.fr>
To: flexcoders@yahoogroups.com
Sent: Tuesday, December 27, 2011 3:51 PM
Subject: Re: [flexcoders] Resize and Scale Window Content
Hi,
I have the same problem.
I use groupe with percent height and width. But this doesn't work if window is resize by as3 script during creationcomplete phase.
If someone has an idea?
thanks
Le 27/12/11 07:54, Asad Zaidi a écrit :you can acheive it using Grid control also. depends upon your requirement.Zaidi
From: claudiu ursica <the_braniak@yahoo.com>
To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com>
Sent: Tuesday, December 27, 2011 3:28 AM
Subject: Re: [flexcoders] Resize and Scale Window Content
In theory yes, by using percent width and height for components, in practice how much works out of the box depeds on every particular case.
C
From: hkondylk <kondylak@gmail.com>
To: flexcoders@yahoogroups.com
Sent: Monday, December 26, 2011 5:35 PM
Subject: [flexcoders] Resize and Scale Window Content
Hello,
I want to be able to resize my Window and the content to scale as the window resizes. Is this possible or do you have an example?
THanks in advnace.
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
0 comments:
Post a Comment