Re: tooltips for each cell of treeview?



On 2002.04.03 20:00 Kang Jeong-Hee wrote:
What I wanna do is like that of Windows Explorer do for long filename.
if long filename cutoff, full length come up as tooltip of the cell.
I've wonder how but can't.
Is there some way?

It's been a while, but I had to do something similar for
Vertex's primitives palette.  It had objects but with no
labels at all and relied on tooltips for each object.

What I did was watch for the motion_notify_event and updated
the tooltip for the GtkDrawable (the main widget for
the primitives palette).  Since you are using a GtkCList
or similar, it should work just fine.

First you need to update the tooltip's message whenever the
motion_notify_event occures over the GtkCList and changes
to a different cell.  When that occures, update the
tooltip message and then force it to reshow by calling
a function similar to:

void GUIShowTipsNow(GtkWidget *w)
{
        GdkEventCrossing e;
        GdkWindow *window;


        if((w == NULL) || !gui_tooltips_state)
            return;

        if(GTK_WIDGET_NO_WINDOW(w))
            return;
        else
            window = w->window;
        if(window == NULL)
            return;

        /* Send a fake enter notify event to make widget think
         * its time to show the tooltips. Note that the widget
         * should be watching for the enter_notify_event.
         */
        e.type = GDK_ENTER_NOTIFY;
        e.window = window;
        e.send_event = 1;               /* True if we're sending event. */
        e.subwindow = window;
        e.time = GDK_CURRENT_TIME;
        e.x = 0.0;
        e.y = 0.0;
        e.x_root = 0.0;
        e.y_root = 0.0;
        e.mode = GDK_CROSSING_NORMAL;
        e.detail = GDK_NOTIFY_ANCESTOR;
        e.focus = TRUE;                 /* Focus. */
        e.state = 0;                    /* Key modifiers. */
        gdk_event_put((GdkEvent *)&e);
}


This is the function I use and it seems to work, pass
the GtkCList as the widget.


--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
..__                         ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]