[Glade-users] Output text to TextView widget. How?
- From: rajarshi presidency com (Rajarshi Guha)
- Subject: [Glade-users] Output text to TextView widget. How?
- Date: 21 Jun 2003 10:59:59 -0400
On Sat, 2003-06-21 at 10:42, Ahmad Al-rasheedan wrote:
I started using Glade 2 days ago and have zillions of questions.
Can you please help in the following code? I basically need to
display "Hi there" in the TextView widget upon pressing of a button.
---
on_button5_clicked (GtkButton *button,
gpointer user_data)
{
gchar output[50]= "Hi there";
GtkWidget *target = NULL;
target = lookup_widget(GTK_WIDGET(button), "textview1");
/ *
Don't know what to put here to have "Hi there" display in the
TextView widget
*/
You could do
void on_button5_clicked(GtkButton *button, gpointer data)
{
gchar output[50] = "Hi there";
GtkWidget *target;
GtkTextBuffer *buffer;
target = lookup_widget( GTK_WIDGET(button), "textview1");
buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(target) );
gtk_text_buffer_insert_at_cursor( buffer, output, strlen(output) );
}
Lookup the API on GtkTextView and GtkTextBuffer - there are lots of
things you can do to text :)
-------------------------------------------------------------------
Rajarshi Guha <rajarshi presidency com> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
How I wish I were what I was when I wished I were what I am.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]