| Summary: | Support markup in tooltip (Control#setToolTipText) | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | davide dav <teabof> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | dev, gregor.rosenauer, ivan, mknauer, tbuschto |
| Version: | 2.2 | ||
| Target Milestone: | 2.2 M3 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
davide dav
Are you talking about the ToolTip widget or the property ToolTipText? the property ToolTipText.
this is sample code
TableViewerColumn tableViewerColumn = new TableViewerColumn(
checkboxTableViewer_grantor, SWT.NONE);
TableColumn tblclmnName = tableViewerColumn.getColumn();
tblclmnName.setText("Name");
tableViewerColumn.setLabelProvider(new ColumnLabelProvider()
{
public String getText(Object element)
{
return Util.getName(element);
}
@Override
public String getToolTipText(Object element)
{
String s= "Name:"+Util.getName(element)+"\nType: ";
s+= Util.getType(element);
return s;
}});
ColumnViewerToolTipSupport.enableFor(tableViewerColumn.getViewer());
Enabling markup for tooltips is generally a good idea and not too difficult, but we may need some time to come up with an API. We can not simply enable it by default because some some code may use "<"/">" without escaping. While we're at it, I think it would also be cool to support links in tooltips, but for that we would need to be able to change the behavior that tooltips disappear when hovered. (Or just turn it of when an "<a>" tag exists.) Alignment could be a theme property, though it currently could only be enabled globally, not on a per-widget basis. (We have the same issue if we would want to configure other aspects like timeout by theming.) Added markup support with commit 6b95f0afc60fa0e8fbdd35daf6d8c6a7a80cb37f. <a> tag is supported, but currently not clickable as tooltip disappears when you move the mouse - we will look on it in the next days. Currently markup in tooltip is enabled with provisional constant RWT.TOOLTIP_MARKUP_ENABLED like: button.setData( RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE ); Great. Can't wait to test it. I hope I find some time next week. Added CSS property "text-align" to Widget-ToolTip element with commit 449c53049873204b7627c35449353e6f40ef39a0. (In reply to Ivan Furnadjiev from comment #6) > Added CSS property "text-align" to Widget-ToolTip element with commit > 449c53049873204b7627c35449353e6f40ef39a0. (In reply to Ivan Furnadjiev from comment #4) > Added markup support with commit 6b95f0afc60fa0e8fbdd35daf6d8c6a7a80cb37f. > <a> tag is supported, but currently not clickable as tooltip disappears when > you move the mouse - we will look on it in the next days. Currently markup > in tooltip is enabled with provisional constant RWT.TOOLTIP_MARKUP_ENABLED > like: > button.setData( RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE ); Hi Ivan, I wonder if this feature is also supported for tool tips created by ColumnViewerToolTipSupport (as can be seen in the sample code from comment 2). Using this feature for widgets which have the property ToolTipText works (e.g. buttons or texts), but it does not seem to work when providing tool tip text with markup from CellLabelProvider.getToolTipText. I tried setting RWT.TOOLTIP_MARKUP_ENABLED to the viewer and to the underlying control after creating the viewer, both ways failed. Am I doing something wrong? Thanks for a short comment on this! Regards, Sebastian same problem here, I'd need to format tooltips in my TableViewerColumn's getToolTipText() method, but the text is presented as is, with formatting tags unparsed. Can we please have this feature fully implemented, not just for simple (widget.setToolTipText()) cases? (In reply to Gregor Rosenauer from comment #8) > same problem here, I'd need to format tooltips in my TableViewerColumn's > getToolTipText() method, but the text is presented as is, with formatting > tags unparsed. > Can we please have this feature fully implemented, not just for simple > (widget.setToolTipText()) cases? Markup in Table column tooltip is supported in RAP. You must set RWT.TOOLTIP_MARKUP_ENABLED to the column like: column.setData( RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE ); no, sadly does not work, try the sample code from comment #2 or this one: TableViewerColumn nameColumn = new TableViewerColumn(myTableViewer, SWT.NONE); nameColumn.setLabelProvider(new ColumnLabelProvider() { ... @Override public String getToolTipText(Object element) { return "<b>bold</b> tooltips yey!"; } will just open a normal tooltip with the literal text <b>bold</b>... (In reply to comment #10) > no, sadly does not work, try the sample code from comment #2 or this one: > > TableViewerColumn nameColumn = new TableViewerColumn(myTableViewer, SWT.NONE); > nameColumn.setLabelProvider(new ColumnLabelProvider() { > ... > @Override > public String getToolTipText(Object element) { > return "<b>bold</b> tooltips yey!"; > } > > will just open a normal tooltip with the literal text <b>bold</b>... If you want markup in cell tooltips you have to enable it on the table like: tableViewer.getTable().setData( RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE ); For markup in column header tooltip, enable it on table column: tableColumnViewer.getColumn().setData( RWT.TOOLTIP_MARKUP_ENABLED, Boolean.TRUE ); Just tested it with our Controls Demo -> TableViewer Tab and both are working fine in RAP 3.0M6. |