Re: GtkText widget and right click menus



On Sun, Dec 10, 2000 at 03:03:17PM -0800, learfox furry ao net wrote:
I got it to work by using gtk_signal_connect_after()
I don't know if it's the right way to do it, but it seems to work.

   Hi, I tried the code you sent me and also using
gtk_signal_connect_after() in my program instead of gtk_signal_connect()
in both cases what happens is when a segment of text is selected and then
I right-click;

   The menu maps but then afterwards any regular clicks on the text
widgets marks a `grey' selection highlighting (instead of the normal blue
selection highlight). Also the grey selection highlight always starts at
the last position I right-clicked.
[snip]

I didn't even notice that, sorry.  This SEEMS to work... :)

#include <gtk/gtk.h>

static GtkWidget *text;  // delete declaration in main()

 ...

gint menu_item_activate_cb (GtkWidget *menuitem, gpointer data)
{
        GtkWidget *label = GTK_BIN (menuitem)->child;
        gchar *label_string;

        gtk_label_get (GTK_LABEL (label), &label_string);
        g_print ("%s\n", label_string);


        GTK_TEXT (text)->button = 0;

        return FALSE;
}

 ...

Hopefully someone else knows the right way of doing it.





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