0

Line break in Messagebox

asked 2008-02-25 15:45:37 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4799588

By: enixser

How can I insert a line break (newline) into a text shown in a messagebox? I tried \n and <br/> but both did not work.

Ralf.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2008-02-25 16:00:10 +0800

admin gravatar image admin
18691 1 10 129
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4799623

By: madruga0315

I have accomplished this creating a new messagebox theme, and then when creating the app I register the new messagebox theme.
Dont know if is the best way, but it works.

Heres the new messagebox theme:

-------------------------------
myMessagebox.zul
-------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<?page title="ZK Test" language="xul/html"?> <window title="${arg.title}" border="normal" width="500px" closable="true"
use="org.zkoss.zul.impl.MessageboxDlg">
<hbox>
<image src="${arg.icon}"/>
<vbox id="vbox" sclass="messagebox">
</vbox>
<zscript>
String str = arg.get("message");
String[] vec = str.split("\n");

for(int i = 0; i < vec.length; i++)
vbox.appendChild(new Label(vec[i]));
</zscript>
</hbox>
<separator bar="true"/>
<hbox style="margin-left:auto; margin-right:auto">
<button id="btn1" identity="${arg.OK}" sclass="messagebox-btn"
use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="${!empty arg.OK}"/>
<button identity="${arg.CANCEL}" sclass="messagebox-btn"
use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="${!empty arg.CANCEL}"/>
<button identity="${arg.YES}" sclass="messagebox-btn"
use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="${!empty arg.YES}"/>
<button identity="${arg.NO}" sclass="messagebox-btn"
use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="${!empty arg.NO}"/>
<button identity="${arg.RETRY}" sclass="messagebox-btn"
use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="${!empty arg.RETRY}"/>
<button identity="${arg.ABORT}" sclass="messagebox-btn"
use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="${!empty arg.ABORT}"/>
<button identity="${arg.IGNORE}" sclass="messagebox-btn"
use="org.zkoss.zul.impl.MessageboxDlg$Button"
if="${!empty arg.IGNORE}"/>
</hbox>
</window>

And the, in my main.java, in the onCreate method, i register the new theme with this line:

public void onCreate()
{
...
Messagebox.setTemplate("/Templates/myMessagebox.zul");
...
}

Hope it helps
Madruga.

link publish delete flag offensive edit

answered 2010-05-10 09:44:14 +0800

brunosantos gravatar image brunosantos
3

you are portuguese?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-02-25 15:45:37 +0800

Seen: 1,385 times

Last updated: May 10 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More