-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all
I have a problem with the carriage return in tooltip.
My code :
return new ListitemRenderer() { @Override public void render(Listitem item, Object data) throws Exception { item.setValue(data); Listcell cell = new Listcell(); item.appendChild(cell); Hbox box = new Hbox(); cell.appendChild(box); [...] toolTip += fieldName + " : " + result + "\n" + "something"; Label label = new Label(extension); label.setTooltiptext(toolTip); box.appendChild(label); } };
And the "\n" is not interpreted...
Thanks for your help,
Regards,
SHERKHAN
a typo ??
toolTip += fiel...
String toolTip = "Long Text " + "\n" + "in two lines works for me";
btnHelp.setTooltiptext(toolTip);
Works perfect for me with 5.0.2
Hmmmmm, runs by me too in 3.6.3.
on startup
String toolTip = "Long Text " + "\n" + "in two lines works for me"; btn100.setTooltiptext(toolTip); System.out.println(btn100.getTooltiptext());
2010-06-28 17:28:57,341 DEBUG InitApplicationCtrl M[onCreate$startWindow] - --> [ForwardEvent onCreate$startWindow <InitApplicationCtrl startWindow>] 2010-06-28 17:28:57,786 INFO ServiceLogging M - Execution time: 2ms CommonService.getAllTablesRecordCounts() Long Text in two lines works for me
an encoding problem?? I use UTF-8
Hi Stephan,
I use UTF-8 too... grrrr
Here is my entire code :
return new ListitemRenderer() { @Override public void render(Listitem item, Object data) throws Exception { item.setValue(data); Listcell cell1 = new Listcell(((Wikitty) data).getId()); Listcell cell2 = new Listcell(); item.appendChild(cell1); item.appendChild(cell2); Collection<String> extensions = ((Wikitty) data).getExtensionNames(); Iterator<String> itCurrent = extensions.iterator(); while (itCurrent.hasNext()) { String extension = itCurrent.next(); String toolTip = getToolTipsByExtension(extension, (Wikitty) data); // toolTip has "\n" if (itCurrent.hasNext()) { extension += ", "; } Label label = new Label(extension); label.setTooltiptext(toolTip); cell2.appendChild(label); } } };
and my zul file part:
<groupbox> <caption label="wikitties" /> <listbox id="wikittiesListBox" rows="8" model="@{win$composer.wikittyModel}" itemRenderer="@{win$composer.wikittyRenderer}" selectedItem="@{win$composer.selectedWikitty}"> <listhead sizable="true"> <listheader label="ID" /> <listheader label="Extensions" /> </listhead> </listbox> <button id="delete" label="Delete" width="46px" height="24px"/> </groupbox>
Maybe I do something bad...
Hi SHERKHAN
Is it not work if you set below string ?
String toolTip = "Long Text " + "\n" + "in two lines works for me";
Hi Jimmy
I tried with this example but it doesn't work... In fact I tried with whatever zk elements but the "\n" are not displayed. The result is always : "Long Textin two lines works for me". Just one line... And I tried with the 5.0.2, nothing changed... RHAAAA what is wrong with me?! I use tomcat and firefox.
Thanks for your help,
SHERKHAN
Have a look on your first loaded page (I work with only ONE page 'index.zul' and Borderlayout Center area for the changed content)
I have the next line in my index.zul file after the <page ....> definition.
<?meta content="text/html; charset=UTF-8" pageEncoding="UTF-8"?>
best
Stephan
Hi Stephan,
Thanks for your help but It doesn't still work... I'm desperate!
Here is my entire zul page (maybe you will find out the mistake...):
<?xml version="1.0" encoding="UTF-8"?> <?page title="wikitties" contentType="text/html;charset=UTF-8"?> <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?> <window id="win" title="wikitty" width="800px" border="normal" apply="org.nuiton.wikitty.ui.WikittyController"> Search: <textbox id="Search" /> <toolbarbutton id="home" label="Select another proxy"/> <listbox autopaging="true" mold="paging" id="extensionListBox" rows="5" model="@{win$composer.extensions}" selectedItem="@{win$composer.selectedExtension}"> <listhead> <listheader label="Name" /> <listheader label="Version" /> </listhead> <listitem self="@{each='extension'}"> <listcell label="@{extension.name}" /> <listcell label="@{extension.version}" /> </listitem> </listbox> <groupbox> <listbox autopaging="true" mold="paging" id="wikittiesListBox" multiple="true" rows="10" model="@{win$composer.wikittyModel}" itemRenderer="@{win$composer.wikittyRenderer}" selectedItem="@{win$composer.selectedWikitty}"> <listhead sizable="true"> <listheader label="ID" /> <listheader label="Extensions" /> </listhead> </listbox> <button id="delete" label="Delete" height="24px"/> </groupbox> <groupbox> <caption label="extensions" /> <listbox id="formListBox" model="@{win$composer.wikittyForm.formModel}" rows="7" itemRenderer="@{win$composer.wikittyForm.fieldExtensionRenderer}"> <listhead sizable="true"> <listheader label="Extension" /> <listheader label="Type" /> <listheader label="Content" /> </listhead> </listbox> <button id="add" label="Add" height="24px"/> <button id="update" label="Update" height="24px"/> <button id="addNewInput" label="New input" height="24px" /> <button id="deleteInput" label="Delete input" height="24px" /> <listbox id="newExtension" rows="1" mold="select" model="@{win$composer.extensions}" selectedItem="@{win$composer.selectedNewExtension}"> <listitem self="@{each='newExtension'}"> <listcell label="@{newExtension.name}"/> </listitem> </listbox> <button id="addNewExtension" label="Add extension" height="24px" /> </groupbox> </window>
Thanks for your help,
Best regards,
SHERKHAN
Asked: 2010-06-28 05:06:34 +0800
Seen: 1,130 times
Last updated: Dec 13 '18