Grid: ToolTip and image in ColumnHeader [message #600013] |
Thu, 22 July 2010 05:15  |
Eclipse User |
|
|
|
Hello everybody,
In our grid, we use images to display vertical text in the column header.
How can I also display a ToolTip when the mouse is hovering over the header?
When no image is shown, it does work, but with image the ToolTip seems to be deactivated.
Best regards,
David
|
|
|
Re: Grid: ToolTip and image in ColumnHeader [message #600162 is a reply to message #600013] |
Thu, 26 August 2010 08:13   |
Eclipse User |
|
|
|
OK, got it by myself.
I extended Grid.java and overwrote handleCellHover(int int).
protected boolean handleCellHover(int x, int y)
{
boolean superResult = super.handleCellHover(x, y);
// redo some code from superMethod to display tooltips in column headers
// when images are shown
final GridColumn col = getColumn(new Point(x, y));
final GridItem item = getItem(new Point(x, y));
if ((col != null)) {
if (item == null) {
if (y < headerHeight) {
if (y >= groupHeaderHeight) {
// on col header
if ((col.getText() != null)
&& ((!col.getText().equals("")) && ((col.getColumnGroup() != null) && (!col
.getColumnGroup().getText().equals("General"))))) {
showToolTip(item, col, null, new Point(x + 15, y));
}
}
}
}
}
return superResult;
}
|
|
|
|
Re: Grid: ToolTip and image in ColumnHeader [message #665969 is a reply to message #600165] |
Mon, 18 April 2011 08:08  |
Eclipse User |
|
|
|
My current solution is one timer that is started every time the mouse hovers a specified time over the same position.
After that the tooltip is shown and another timer is started. This second timer makes sure, the tooltip is deleted after a while:
getDisplay().timerExec(m_headerTooltipDelayMS, new Runnable() {
public void run() {
if ((m_lastMousePos_x == x) && (m_lastMousePos_y == y)) {
showToolTip(item, col, null, new Point(x + 15, y));
m_tooltipActive = true;
// Make sure that the tooltip will be hidden after a specified time
getDisplay().timerExec(m_headerTooltipPresentMS,
new Runnable() {
@Override
public void run() {
// Make sure the grid has not been disposed since the call
if (!isDisposed()) {
hideToolTip();
m_tooltipActive = false;
}
}
});
}
}
});
|
|
|
Powered by
FUDForum. Page generated in 0.05086 seconds