![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Sep 2005
Posts: 50
Rep Power: 4
![]() |
GTK+-2.0 and textview problem
I've done quite a bit of googling and i looked at the GTK tutorials but the textview part is blank and the google stuff is coming up with non C code. I was just wondering what i needed in my signal event function for say..button1 to output some string to the textview window. Thanks.
|
|
|
|
|
|
#2 |
|
Programmer
Join Date: Sep 2005
Posts: 50
Rep Power: 4
![]() |
Nevermind, solved my own problem
![]() |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Mind posting the solution for us, mate?
|
|
|
|
|
|
#4 |
|
Programmer
Join Date: Sep 2005
Posts: 50
Rep Power: 4
![]() |
Is this the great BOoble asking?
|
|
|
|
|
|
#5 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#6 |
|
Programmer
Join Date: Sep 2005
Posts: 50
Rep Power: 4
![]() |
in your callbacks, say for example you had a widget called button1 which you want an action when clicked you have this:
void on_button1_clicked (GtkButton *button, gpointer user_data)
{
GtkTextBuffer *buffer;
GtkTextIter iter;
/*first you need to find the widget name of the textview box, say for example it's called textview1 in this case, you're only concerned with txtbox which is the identifier to the widget "textview1"*/
GtkWidget *txtbox=lookup_widget(GTK_WIDGET (button), "textview1");
/*You then need to set the buffer to the size of the textview area*/
buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(txtbox));
/*Now you need to set the offset; the number of characters to display before you start overlapping at 0 again. Play with the number and see the difference.*/
gtk_text_buffer_get_iter_at_offset(buffer, &iter, 0);
/*Insert text time...*/
gtk_text_buffer_insert(buffer, &iter, "Hello World!",-1);
}I wish they would update stuff for the GTK+-2.0 tutorials ![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|