0

New line in messagebox?

asked 2009-04-17 12:28:50 +0800

kkurt gravatar image kkurt
300 1 2

How can we use new line in Messagebox?

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2009-04-17 12:37:37 +0800

Kuikiker gravatar image Kuikiker
144

Check this topic

link publish delete flag offensive edit

answered 2009-04-17 12:50:11 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

I'll post this evening a sample for a multiline messagebox that i use.

regards
Stephan

link publish delete flag offensive edit

answered 2009-04-17 15:01:06 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-04-17 15:05:12 +0800

Hi kkurt,

attached my multiLineMessageBox. It works with Labels.getLabel() for
internationalization.

MultiLineMessagebox.java

package org.myfirm.webui.util;

import org.zkoss.zul.Messagebox;

public class MultiLineMessageBox extends Messagebox {

   private static final long serialVersionUID = -4855008103857120664L;
   private static String _templ = "/WEB-INF/pages/util/multiLineMessageBox.zul";

	public MultiLineMessageBox() {
	}

	public static void doSetTemplate() {
		setTemplate(_templ);
	}

	/**
	 * Shows a message box and returns what button is pressed. A shortcut to
	 * show(message, null, OK, INFORMATION). <br>
	 * <br>
	 * Simple MessageBox with customizable message and title. <br>
	 * 
	 * @param message
	 *            The message to display
	 * @param title
	 *            The title to display
	 * @return
	 * @throws InterruptedException
	 */
	public static final int show(String message, String title) throws InterruptedException {
		return show(message, title, OK, INFORMATION, 0, null);
	}

}

MultiLinemessageBox.zul

<?xml version="1.0" encoding="UTF-8"?>
<?page title="Multiline Messagebox" language="xul/html"?>

<window title="${arg.title}" border="none" width="300pt" closable="true"
	use="org.zkoss.zul.impl.MessageboxDlg">

	<hbox>
		<div class="${arg.icon}" />
		<div sclass="z-messagebox" width="100%">
			<label multiline="true" value="${arg.message}"
				sclass="word-wrap" width="100%" />
		</div>
	</hbox>

	<separator bar="true" />

	<hbox style="margin-left:auto; margin-right:auto">
           <button id="btn1" identity="${arg.OK}" sclass="z-messagebox-btn"
	           use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" />
           <button identity="${arg.CANCEL}" sclass="z-messagebox-btn"
	           use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" />
           <button identity="${arg.YES}" sclass="z-messagebox-btn"
	           use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" />
           <button identity="${arg.NO}" sclass="z-messagebox-btn"
                   use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" />
           <button identity="${arg.RETRY}" sclass="z-messagebox-btn"    
                   use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" />
           <button identity="${arg.ABORT}" sclass="z-messagebox-btn"
	           use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" />
           <button identity="${arg.IGNORE}" sclass="z-messagebox-btn"
                   use="org.zkoss.zul.impl.MessageboxDlg$Button" if="$" />
       </hbox>
</window>

Sample call:

   ...
   // set the message and title
   String msg = Labels.getLabel("message_Data_Modified_Save_Data_YesNo");
   String title = Labels.getLabel("message_Information");

   MultiLineMessageBox.doSetTemplate();
   // Same call like the normal MessageBox
   if (MultiLineMessageBox.show(msg, title, Messagebox.YES | Messagebox.NO, Messagebox.QUESTION, new 
                                     EventListener() {
        public void onEvent(Event evt) {
        ...

i3-label.properties

message.question.are_you_sure_to_delete_this_record={
Hi guys,

are you sure 
to delete 
this record ?
}

regards
Stephan

link publish delete flag offensive edit

answered 2009-04-17 15:39:31 +0800

YamilBracho gravatar image YamilBracho
1722 2

Thanks Terry for sharing this code...

link publish delete flag offensive edit

answered 2009-04-20 21:45:31 +0800

kkurt gravatar image kkurt
300 1 2

Thank you Stephan.

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: 2009-04-17 12:28:50 +0800

Seen: 716 times

Last updated: Apr 20 '09

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