[Glade-users] gtk/glade programming
Günther Mittermayer
g_mitter@web.de
Thu, 25 Sep 2003 14:00:05 +0200
Hi Seb,
not sure I understood exactly your problem, but check the comments:
> void
> on_serial_data_receive (gpointer user_data,
> gint fd,
> GdkInputCondition target_io_states)
> {
> GtkWidget *console_textview;
>
> char buf[255];
> gint res;
>
> /* Don't know how to call lookup_widget in this case: */
> console_textview = lookup_widget (GTK_WIDGET (console_textview), "consol=
e_textview");
Your console_textview is declared in your function, of course this won't work.
Do you mean the window hasn't yet been created? if so, you should first create it, then you'll have the reference you need. Something like that:
// assuming you've created a dialog called "console_textview" in Glade.
console_textview = create_console_textview();
//shows the console
gtk_widget_show(console_textview);
Otherwise, if the window has already been created somewhere else, than you should hold a copy of the reference (passing it as a parameter, or .. well, declaring it global, maybe?)
> /* Plus output it to the console window: */
> gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (conso=
le_textview)),
> _("Buffer text"), -1);
> /* How to replace "Buffer text" with "%s", buf ? */
How about a simple buf instead of the whole _() thing? like that:
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (console_textview)), buf, -1);
Hope it helps,
Günther.
______________________________________________________________________________
Zwei Mal Platz 1 mit dem jeweils besten Testergebnis! WEB.DE FreeMail
und WEB.DE Club bei Stiftung Warentest! http://f.web.de/?mc=021183