Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Grid: ToolTip and image in ColumnHeader
Grid: ToolTip and image in ColumnHeader [message #600013] Thu, 22 July 2010 09:15 Go to next message
David  is currently offline David Friend
Messages: 23
Registered: June 2010
Junior Member
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 12:13 Go to previous messageGo to next message
David  is currently offline David Friend
Messages: 23
Registered: June 2010
Junior Member
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 #600165 is a reply to message #600013] Thu, 26 August 2010 12:58 Go to previous messageGo to next message
David  is currently offline David Friend
Messages: 23
Registered: June 2010
Junior Member
Hm, this way, the tooltip gets displayed immediatly, without the delay that i specified in my CellLabelProvider.
How can i get the delay also in the header?
Re: Grid: ToolTip and image in ColumnHeader [message #665969 is a reply to message #600165] Mon, 18 April 2011 12:08 Go to previous message
David  is currently offline David Friend
Messages: 23
Registered: June 2010
Junior Member
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;
                         }
                 }
             });
          }
      }
});
Previous Topic:[Nebula Gallery] Drop issue
Next Topic:Best way to implement Undo/Redo in Nebula Grid
Goto Forum:
  


Current Time: Tue Dec 23 03:11:35 GMT 2014

Powered by FUDForum. Page generated in 0.02788 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software