Re: Buttons and Windows.




>Q1 - How would one change a button's label during run-time?

gtk_label_set_text(GTK_LABEL(somelabel), car *newtext)

>Q2 - How can I find out what window a button came from (from
>OnClickEvent) so I can destroy that window?  I don't want to make the
>window global as it's created at run time and hopefully disposed of then
>too.:)

Try the gtk_widget_get_toplevel() or some similar call.  I can't remember
the exact name of the call.  Here's a way to "cheat" that I used before I
knew how to do this myself...

GtkWidget *get_widget_window(GtkWidget *input){
	GtkWidget *foo = input;

	while(foo){
		if(GTK_IS_WINDOW(foo)) break;
		foo = foo->parent;
	}
	return(foo);
}

Watch out for this returning NULL.  I haven't tested it much, but it
should work.  It will stop when it hits a window that is a parent of the
widget you passed in.

Hope it helps.

David

http://opop.nols.com/ Free Software Development
==========================================================================
Der Horizont vieler Menschen ist ein Kreis mit Radius Null -- und das
nennen sie ihren Standpunkt.
==========================================================================
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'



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