Re: Multiline Textbox...



why were they deprecated? gtk_text widget is simpler than the
gtk_view...

I had problems retrieving the text from text_buffer using text_iter...

what should I do to define the text range from start to the end of the
text view?

I mean, start iter will have 0 and end iter will  have '?'?

I tried using both
gtk_text_buffer_get_text(.. ...)
&
gtk_text_buffer_get_slice(... ...)

but I keep getting text stored *initially* on the buffer.. :(

Here's my code snippet:

view = gtk_text_view_new ();
// my text view..

                buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

                gtk_text_buffer_set_text (buffer, "My test Message from code..",
-1);



                gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 30);

                gtk_box_pack_start (GTK_BOX (GTK_DIALOG (popup)->vbox),
                        view, TRUE, TRUE, 0);

                gtk_text_buffer_get_start_iter  (buffer, &start);
                gtk_text_buffer_get_end_iter    (buffer, &end);
                
                gtk_text_buffer_get_iter_at_offset (buffer, &start, 0);
                gtk_text_buffer_get_iter_at_offset (buffer, &end, 1000);
                
                // here's my problem-1 :: I gotto set the iter to cover all the text
typed in... 

                mlhdr.body = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
                //mlhdr.body = gtk_text_buffer_get_slice (buffer, &start,
&end,                                           FALSE);

( I tried even the second one... )
               gtk_widget_show (view);


Now, when I run the code & I type something deleting the text I've set
initially, I'm unable to *retrieve* it in my mlhdr.body.. :(

instead the same thing  keeps appearing...


On Fri, 2004-01-02 at 06:00, Keith Maika wrote:
hpnadig wrote:
I need a multi line text widget in my application.  But when I went
through the  GTK manual, I came across this widget called 'text' widget
which has been deprecated...

Is there any alternative widget that I can use?

also I need to get the text entered -(back) for processing....

Now you use the widgets GtkTextView and GtkTextBuffer to display a 
multi-line edit box.  You can read up on them here:

http://developer.gnome.org/doc/API/2.0/gtk/TextWidgetObjects.html
-- 
http://www.hpnadig.com || hpnadig at lycos dot co dot uk




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