Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Autres langages pour le Web
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 11/05/2008, 17h02   #1
Invité de passage
 
Inscription : mai 2008
Messages : 4
Détails du profil
Informations forums :
Inscription : mai 2008
Messages : 4
Points : 1
Points : 1
Par défaut [OPenLaszlo] Afficher des bouttons en fct de fichier xml

Bonjour, tout d'abord jespere que je suis dans la bonne section pour poster ma requête

Je suis débutant en OpenLaszlo et jai coder le code suivant d'apres le webcast mais mon but est d'afficher des basebutton avec un x et un y provenant du fichier xml

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<canvas debug="true" width="1020">
	<dataset src="http:resultat.xml" name="dsProduits" request="true"/>
	<resource name="mybutton_rsrc">
	    <!-- first frame MUST be the mouseup state of the button -->  
	    <frame src="button-up.png"/>
		<!-- second frame MUST be the mouseover state of the button -->
		<frame src="button-over.png"/>
		<!-- third frame MUST be the mousedown state of the button -->
		<frame src="button-down.png"/>
	 </resource>
	
	 <window name="plan">	
		<view name="image"  resource="plan_sup.gif"/> 
		<basebutton name="mybutton"  resource="mybutton_rsrc" x="20" y="20">
		</basebutton>
	 </window>
	
	<window name="liste" title="Produits" width="200" height="150" x="${plan.x + plan.width + 10}" y="20" resizable="true">
		<view>	
			<text onmouseover="this.setBGColor(0xBBBBFF)" onmouseout="this.setBGColor(null)">
				<datapath xpath="dsProduits:/objets/objet/@nom" replication="lazy"/>
				<handler name="onclick">
					var details = new detailswindow(canvas);
					details.datapath.setFromPointer(this.datapath);
				</handler>
			</text>
		</view>
		<scrollbar/>
	</window>
 
	<class name="detailswindow" extends="window" title="$path{'@nom'}" x="${liste.x}" y="${liste.y + liste.height}" resizable="true"  width="200" height="300" closeable="true">
		<datapath/>
		<method name="close">
			bye.doStart();
			this.fadeDelegate = new LzDelegate( this, "fadeWindow" );
			LzTimer.addTimer( this.fadeDelegate, 3000 );
		</method>
		<animatorgroup name="bye" process="sequentieal" duration="1500" start="false">
			<animator attribute="height" to="50"/>
			<animator attribute="x" to="$path{'@x'}"/>
			<animator attribute="y" to="$path{'@y'}"/>
			
		</animatorgroup>
		<method name="fadeWindow">
			this.animate( "opacity", 0.0, 1000 );
		</method>
		<simplelayout/>
		<text datapath="@prix" width="100%" multiline="true"/>
	</class>
  
</canvas>
mon fichier xml source étant
Code :
1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="ISO-8859-1"?>
<objets xmlns:dyn="http://exslt.org/dynamic">
<objet x="450" y="300" nom="1664" prix="10"/>
<objet x="460" y="250" nom="Kro" prix="12"/>
<objet x="455" y="275" nom="Belle brasseuse" prix="5"/>
<objet x="460" y="70" nom="Pastis" prix="13"/>
<objet x="460" y="90" nom="Vodka" prix="8"/>
<objet x="460" y="110" nom="Absinthe" prix="15"/>
</objets>
mon pb se trouve ici
Code :
1
2
3
4
5
<window name="plan">	
	<view name="image"  resource="plan_sup.gif"/> 
	<basebutton name="mybutton"  resource="mybutton_rsrc" x="20" y="20">
	</basebutton>
 </window>
je voudrais paramétrer le x et le y en fonction de ceux du dataset mais quand je remplace par
Code :
1
2
3
4
5
6
<window name="plan">	
	<view name="image"  resource="plan_sup.gif"/> <datapath xpath="dsProduits:/objets/objet/"/>
	<basebutton name="mybutton"  resource="mybutton_rsrc" x="$path{'@x'}" y="$pat{'@y'}">
	</basebutton>
 </window>
cela me créer 6 windows avec 1 image et 1 boutons chacune car jai 6 elements dans mon fichier xml et ca place les boutons tous au meme endroit :-/
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
	 <window name="plan">	
		<view name="image"  resource="plan_sup.gif"/> 
		<datapointer xpath="dsProduits:/objets/" ondata="processData()">
			<method name="processData">
				this.selectChild(1); 
				do {
				<basebutton name="mybutton"  resource="mybutton_rsrc" x="$this.xpathQuery('@x')" y="$this.xpathQuery('@y')"/>
				 Debug.write(this.xpathQuery('@x')+this.xpathQuery('@y'));
		      } while (this.selectNext()); 
			</method>
		</datapointer>
	 </window>
ne marche pas non plus pourtant je parcours bien mes 6 noeuds :-/

bien évidement je voudrais arriver :
- dans un premier temps que mes boutons soient tous placés sur la meme window
- dans un deuxième temps, à afficher les details(ie le prix) du produit non plus en cliquant dans la liste mais en cliquant sur mon bouton


Merci d'avance j'espere avoir était assez clair
sam.cfc est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 16h22.


 
 
 
 
Partenaires

Hébergement Web