[Glade-users] how can I display an entire text file in Gtktext widget?



On Tue, 2008-07-08 at 13:20 +0530, vishudh ps wrote:
The second argument is "gpointer  user_data". What change should I
make to the second argument to get the pointer of textview, and
where(only in callback.c, or anywere else needed)?

?There are three options.
1. You can type your textview widget name in User data field for
"clicked" signal of your button in glade. Then your user_data pointer
will be pointer to the button, and the first argument will be pointer to
the textview. It is ugly and not very useful, cause most likely you will
need to access more than just textview widget in your callback.
2. You can use glade_xml_signal_connect_data() for each callback instead
of just using glade_xml_signal_autoconnect(), and set your user_data to
whatever you please (usually a structure containing relevant pointers).
It is somewhat tedious, but it is the proper way. I use it for big
projects.
3. Make everything you need to access global. It is perfectly fine for a
small app. Just do not forget to initialize your globals with
glade_xml_get_widget(). If you do not do this your globals are pointing
nowhere which was likely your problem in the initial case.


On 7/8/08, Lukasz Gromotowicz <gromot at gmail.com> wrote:
        Hi,
        first of all read here:
        http://library.gnome.org/devel/gtk/2.6/GtkText.html
        It says the GtkText is deprecated... instead it use
        GtkTextView. Then having a pointer to GtkTextView use
        gtk_text_view_get_buffer to get its buffer. You must load
        whatever you want to display to this buffer.
         
        When you define the callback function you can add a pointer to
        any structure / object you want (last parameter of the
        callback). Pass a pointer to your textView.
         
        Regards,
        LUK
        
        
         
        2008/7/7 vishudh ps <vishudh at gmail.com>:
                I am new to glade and trying to create an editor in
                glade.So, I want to change the content of a Gtktext
                widget with a text file when a button is clicked.Both
                the text and button are children of diffrent windows.
                The problem is, I cannot access the text widget from
                the callback function of the button.what is the
                solution to get the text widget on "clicked" callback
                of the button? I tried with global variables, But make
                returns error: 
                "gtk_text_insert: assertion 'GTK_IS_TEXT(text)'
                failed". 
                Please help me to insert text in to the text widget.
                Thanks in advance.
                
                _______________________________________________
                Glade-users maillist  -  Glade-users at lists.ximian.com
                http://lists.ximian.com/mailman/listinfo/glade-users
                
        

_______________________________________________
Glade-users maillist  -  Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users




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