How to remove a popup sets by setPopup ?
you can set new popup directly,
try following code
1. click the user
2. click the button
3. click the user again
<zk>
<label id="lb" value="user" popup="msg" />
<popup id="msg" width="300px">
<vbox>
This user is online now !
<toolbarbutton label="Mail him/her"/>
</vbox>
</popup>
<popup id="msg2" width="300px">
<vbox>
This user is offline now !
</vbox>
</popup>
<button label="off" onClick="lb.popup=msg2" />
</zk>Thank you very much. Your example works well but in Java, I don't have the same behaviour.
This is my code :
Popup popup = new Popup();
popup.appendChild(new Text(Labels.getLabel("editeur.nombredesignes.message") + longueur.toString()));
editeurControleur.appendChild(popup);
mybutton.setPopup(popup);When I click on mybutton 2 times, I have 2 popups displayed !
im not sure what happen in your code,
i use setPopup but i don't have same problem.
<zk>
<label id="lb" value="user" />
<popup id="msg" width="300px">
<vbox>
This user is online now !
<toolbarbutton label="Mail him/her" />
</vbox>
</popup>
<popup id="msg2" width="300px">
<vbox>This user is offline now !</vbox>
</popup>
<button label="set 1" onClick="go(1)" />
<button label="set 2" onClick="go(-1)" />
<zscript><![CDATA[ //@DECLARATION
//popup="msg"
void go(int i) {
lb.setPopup(i == 1 ? msg : msg2);
}
]]></zscript>
</zk>Thank you.
Is it a ZK bug ?
Do you know ?
Please provide more code to let us judge if it's a bug or misusage.
No matter what,
Please post it to bug in
http://sourceforge.net/projects/zk1/
to let us track it.
When I click on a button, it runs this code :
Popup popup = new Popup();
popup.appendChild(new Text("text"));
myWindow.appendChild(popup);
image.setPopup(popup);
When I click on the image, it displays x popups if I clicked x times on the button.
this happens because every time you click the button you create a new Popup object with a new Id.
You could set the popup an id, and when the button is clicked, you test if the popup already exists
something like this
Popup popup = (Popup)myWindow.getFellowIfAny("popup");
if(popup == null){
popup = new Popup();
popup.setId("popup");
}
// code to manipulated popup (and its children) valueThen you can click the button n times, and only one popup will be showed.
Regards,
/Madruga
Thank you very much, it works well !
ZK - Open Source Ajax Java Framework
Hello,
I add a popup via setPopup, then I want to remove it and add a new popup. Do you know how I can remove the old popup ?
Thank you.