Re: Carriage Return/Line Feed in GTK Text Box




Lyndon Drake <lyndon@stat.auckland.ac.nz> writes:

> On Tue, Dec 01, 1998 at 10:19:37AM -0500, Crampton, Ray  wrote:
> > I am using a gtk text box in an application where I write characters one at
> > a time as they are received over a network connection. Here's my
> > gtk_insert_text line:
> > 
> > gtk_text_insert(GTK_TEXT(text_box),NULL,NULL,NULL,buff,1);
> > 
> > Here are some earlier declarations:
> > 
> > char buff[5];
> > GtkWidget *main_text_box;
> > main_text_box = gtk_text_new (NULL,NULL);
> > 
> > When I try to insert a carriage return / line feed nothing happens. Any help
> > in how to handle this so that CR/LF acts "normally" would be greatly
> > appreciated.
> > 
> 
> You could try emitting a "key_press_event" signal to the text box, with a
> GDK_Return key code.

No, no. Please don't do that (it will work, assuming the
cursor is in the right place but...) I'm pretty certain
that inserting a literal "\n" in the text widget works fine,
since that's how all the new lines in the testgtk example
text widget are inserted.

(The text widget expects the standard Unix LF line delimeniters.
I don't know what the effect of CR/LF pairs on it is.)

Regards,
                                        Owen



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