Re: "clicked" signal on a selected row in a TreeView



On Mon, 2002-07-01 at 22:27, Jeremy Wise wrote:
I'm doing this in gnomeicu (CVS HEAD), and it works with one minor
problem... it calls the menu, then changes the selection... so at start,
nothing's selected.. i click on A.. no menu.. i click on B, menu comes
up for A.. i click row C, i get a menu like i clicked on B.. i click on
C again, i get C... i tried changing the signal in glade to be "After",
but then no menu whatsoever...

Ideas?

Thanks!

Here's what I do in GnomeChat for that situation:

static gboolean
userlist_button_press_event_cb (GtkTreeView * view,
                                GdkEventButton * event,
                                gpointer data)
{
    EscoChatBox *box = ESCO_CHAT_BOX (data);
    GtkTreePath *path;
    GtkTreeViewColumn *col;
    GdkRectangle rect;

    if (event->button == 3)
    {
        gtk_tree_view_get_path_at_pos (view, event->x, event->y, &path,
                                       &col, NULL, NULL);

        if (!path)
            return FALSE;

        rect.x = event->x_root;
        rect.y = event->y_root;

        if (!GTK_IS_WIDGET (box->userlist_menu))
        {
            box->userlist_menu = gtk_menu_new ();
            menu_fill_userlist_popup (box->userlist_menu, box);
        }
        gtk_menu_popup (GTK_MENU (box->userlist_menu), NULL, NULL,
                        (GtkMenuPositionFunc) userlist_menu_pos_func,
                        &rect, event->button, event->time);
    }
    return FALSE;
}

Peace,

    Jim Cape
    http://ignore-your.tv/

    "No cause, no God, no abstract idea can justify the mass
     slaughter of innocents."
        -- Edward Said




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