Re: GtkTextBuffer, insert_text



Thanks for the reply
still didn't work?
i wonder what's the problem!!!!

On Fri, 2002-07-19 at 04:21, Rich Gautier wrote:
    ï
    I think your callback function needs to have GtkWidget *widget as
    the first passed parameter.
     
    such as:
     
    void text_insert_cb(GtkWidget *buffer, ..., gpointer user_data) 
     
    because the callback function is going to cast it as a basic widget
    when it makes the call.  You may be able to recast it once it's in
    your callback function, but it's not passed as GtkTextBuffer type..
     
    Rich G
        ----- Original Message ----- 
        From: Mohammed Sameer
        To: gtk-app-devel-list gnome org
        Sent: Thursday, July 18, 2002 7:28 PM
        Subject: GtkTextBuffer, insert_text
        
        Hi all 
        i have a small problem 
        
        i have a textbuffer 
        
          contents = gtk_text_view_new (); 
          buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents)); 
                /* Implementing undo/redo... */ 
        insert = g_signal_connect (GTK_OBJECT (buffer), "insert_text", 
                                GTK_SIGNAL_FUNC (text_insert_cb), NULL);
        
        and the callback 
        void text_insert_cb(GtkTextBuffer *buffer, 
                                                    GtkTextIter pos, 
                                                    const gchar *text, 
                                                    gint length, 
                                                    gpointer user_data) 
        { 
        fprintf(stderr,"%s", text); 
        } 
        
        but it prints some garbage 
        and when i run the program i get: 
        GLib-GObject-WARNING **: invalid cast from `GtkTextBuffer' to
        `GtkObject' 
        
        what's the problem here ? 
        can anyone point me ?? 
        
        Thanks a million 
        
        -- 
        ----------------
        -- Uniball @ DALnet
        Linux registered user # 224950
        ICQ # 58475622
        With Great Power, Comes Great Responsibilities.
-- 
----------------
-- Uniball @ DALnet
Linux registered user # 224950
ICQ # 58475622
With Great Power, Comes Great Responsibilities.




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