Re: Put text in a textwidget from main.c (using Glade)
- From: Markus Lausser <sgop users sourceforge net>
- To: Magnus-swe <magnus-swe extra netlink se>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Put text in a textwidget from main.c (using Glade)
- Date: Sat, 3 Feb 2001 18:02:57 +0100
On Tue, Jan 30, 2001 at 08:10:32PM +0100 Magnus-swe wrote:
Hi.
Im having trouble finding an answer on inserting text in an already
created Textwidget from Main.c
Using Glade.
I have no trouble putting text in the textbox from callbacks.c, but i
want it done when the application starts
i also want to know how to put some text in an entrywidget in the same
manner.
This the code that gets the text wich i want to set in the textbox
FILE *file = fopen("MasqFire-Table", "r");
char buffer[1024];
if (!file] return -1;
while (fgets(buffer, 1024, file)!=NULL)
//printf( buffer );
fclose ( file );
An example would be nice :)
// Magnus-swe
int main(...)
{
[...]
win = create_main_window();
setup_text_widgets();
gtk_widget_show(win);
gtk_main();
[...]
}
void setup_text_widgets()
{
[...]
// maybe first clear the text widget
[...]
// open file
[...]
// load file into text widget
gtk_text_freeze(gtk_text);
while (line = read_line_from_file())
gtk_text_insert(gtk_text, ...., line);
gtk_text_thaw(gtk_text);
// close file and do something else
[...]
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]