How to create Multiline text entry?



It seems that GTK text entry widget only support Single line text entry,so if I want to use multiline text entry widget,how ? I had tried Multiline text editor to set and get text as text entry widget can do,but it doesn't work.
If my fuction use text entry widget to set text like this ......
void entry_set_receive(GtkWidget *widget,
                               GtkWidget *text)
{

data_from_input = gtk_entry_get_text(GTK_ENTRY(entry));
gtk_text_insert (GTK_TEXT (show_output), NULL, &text->style->black, NULL,
                       data_from_input, -1);

}
/* Create the Gtk Entry widget to get Single line input from end-user */
   entry = gtk_entry_new_with_max_length (50);
   gtk_table_attach_defaults(GTK_TABLE(table), entry, 0, 10, 0, 1);

   gtk_signal_connect(GTK_OBJECT(entry), "activate",
                      GTK_SIGNAL_FUNC(enter_callback),
                      entry);
gtk_entry_select_region (GTK_ENTRY (entry), 0, GTK_ENTRY(entry)->text_length);
   gtk_paned_add2 (GTK_PANED(vpaned), entry);
   gtk_widget_show (entry);

/* Create the GtkText widget to show output */
 show_output= gtk_text_new (NULL, NULL);
 gtk_text_set_editable (GTK_TEXT (show_output), TRUE);
 gtk_table_attach (GTK_TABLE (table), show_output, 0, 1, 0, 1,
                   GTK_EXPAND | GTK_SHRINK | GTK_FILL,
                   GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
 gtk_widget_show (show_output);

All of this works properly.
But if I changed from use entry_set_receive() to use multiline_set_receive() to use as Multiline text entry like this.......
void multiline_set_receive(GtkWidget *widget,
                                   GtkWidget *text)
{

data_from_input = gtk_text_buffer_get_text  (multiline_text,
gtk_text_buffer_get_start_iter (multiline_text_input,GtkTextIter *iter), gtk_text_buffer_get_end_iter (multiline_text_input,GtkTextIter *iter),
                                      FALSE);
gtk_text_buffer_set_text (show_output,data_from_input, gtk_text_buffer_get_char_count (multiline_text_input););
}

/* Create the GtkText widget to get Multiline input from end-user */
 multiline_text_input= gtk_text_new (NULL, NULL);
 gtk_text_set_editable (GTK_TEXT (multiline_text_input), TRUE);
 gtk_table_attach (GTK_TABLE (table), multiline_text_input, 0, 1, 0, 5,
                   GTK_EXPAND | GTK_SHRINK | GTK_FILL,
                   GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
 gtk_widget_show (multiline_text_input);

It doesn't work....................................
By the way have anybody can give example of how to use GtkTextIter *iter,please? because there is no example of tutorial(in coding)(I only found the function on the tutorial,but there is no any of coding example at all) about how to use it and I think that maybe it related with the thing that I mentioned above too.
Thanks lot for all of your advise.
Regards,

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail




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