View Full Version : info please in gtk+


maslan
:)
hi all

i wanna 2 know something
when i program in gtk+ & create the widgets,menu ,etc
in a file called interface.c
& the callbacks functions in callback.c
as i uses glade
so when i wanna to use an widget in a func in callback
i need 2 use lookup_widget (a func. in support.c)

so i'm asking is i can make my widget publics to be used & accessed from any other function in another files
can i use extern or what ?

send me an example source.

salam ;)

uniball
I don't use glade.
in Katoob i have a struct that contains any widgets to be accessed publically.

main.c:
GtkWidget *foo;
int main(int argc, cgar *argv[])
{
gtk_init(&argc, &argv);
foo = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(foo);
gtk_main();
return 0;
}

foo.c:

void do_any_thing_with_foo()
{
extern GtkWidget *foo;
/* Code. */
return;
}

maslan
ah u mean to use extern
but does it work in another source file ?
ok i will try anyway
thanks my freind
;)

uniball
Originally posted by maslan

but does it work in another source file ?


If it's a global variable.


Revise your C knowledge :-)
Why don't you declare it in a header file ??

maslan
:D
yes i will do it