Re: How to use GtkTextView?



On Fri, 2004-03-26 at 20:14, Josà Alejandro Manuel GarcÃa wrote:
Hi guys, Today I want to ask something about managment of Text
widgets.
 
Before in Gtk v.1.2 there was a widget named 'GtkText', with this
widget I could write text like a editor, I wanted to do a program that
inserts text into that widget, for example: I put 2 buttons with label
'*' and '+', and when I make clic in any button, its label writes
itself into GtkText (the program is like a calculator). For this There
was a function named 'gtk_text_insert', but checking the API Reference
I saw: GtkText is deprecated, use GtkTextView.
 
Now, my question is: How could I do that program using GtkTextView?

GtkTextView is not independent now, you must change the text in the
GtkTextBuffer associated with it, not in the text view itself.

GtkTextView* view;
GtkTextBuffer*  buffer;
const gchar* text = "Hi";

buffer = gtk_text_view_get_buffer     (view);
gtk_text_buffer_insert_at_cursor( buffer, text ,strlen(text));

I did check the API Reference, but I didn't understand its use.

MAy be better to start here:
http://developer.gnome.org/doc/API/2.0/gtk/TextWidget.html
-- 
Iago Rubio                http://www.iagorubio.com          
GPGkey pgp.rediris.es id 0x909BD4DD  fingerprint =
D18A B950 5F03 BB9A DD89  AA75 FEDF 1978 909B D4DD
********** iago.rubio(AT)hispalinux.es  **********     
--------------------------------------------------

Attachment: signature.asc
Description: This is a digitally signed message part



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