RE: GtkText Problems Update



You could simplify the code and eliminate variables temp and size using;

gtk_text_backward_delete(GTK_TEXT(text),
gtk_text_get_length(GTK_TEXT(text));

Hope this helps.



				-- Stupid Genius
P.S.
When using the gtk_editable_get_chars() method, don't forget to free() temp
when you are done.

> ----------
> From: 	CyborgHead netscape net[SMTP:CyborgHead netscape net]
> Sent: 	Wednesday, March 07, 2001 12:04 PM
> To: 	CyborgHead netscape net
> Cc: 	gtk-list gnome org
> Subject: 	Re: GtkText Problems Update
> 
> Ignore the last question. I figured it out I hope.
> 
> 
> char *temp = gtk_editable_get_chars( GTK_EDITABLE( text ), 0, -1);
> int size = strlen(temp);
> gtk_text_backward_delete( GTK_TEXT( text ), size );
> 
> I think that this should work.
> Is there a better way.
> 
> 
> CyborgHead netscape net wrote:
> >
> > Hello.
> >      I am having a problem with GtkText. I have a Text Box, which is
> updated bu a function finding errors in a script. If errors are found a
> dialog box appears with all the errors in the Text Box. If I close this
> dialog box, and try to parse the script again, naturally it should have
> the same errors and does, however the errors are added on to the end of
> the existing information in the text box, meaning that the smae errors are
> printed twice. I want the Text Box to be cleared before each parseing. I
> tried gtk_entry_set_text() but it would not accept the typecasting of a
> GtkText to GtkEntry. 
> >     I then tried gtk_text_backward_delete(), however I do not know how
> many characters will be in the textBox, therefore cannot specify this. I
> tried setting a very high value such as 10000, but this didn't work. I
> also tried -1, thinking that it might mean delete all character as in
> gtk_text_insert, which also didnt work.
> > 
> > Any ideas how I can empyt the TextBox.
> > Thanks
> > 
> > Ciaran
> > __________________________________________________________________
> > Get your own FREE, personal Netscape Webmail account today at
> http://webmail.netscape.com/
> > 
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> > 
> __________________________________________________________________
> Get your own FREE, personal Netscape Webmail account today at
> http://webmail.netscape.com/
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 




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