Re: gtk_object_get_data



>  Easy quiestion: How would I do to get the width of a canvas text? I have tried this:
>  
>  gtk_object_get_data (GTK_OBJECT (text), "text_width")
>  
>  but it always returns NULL. Is this the right function or if not
>  what is the right way? I've looked through the gtk+ docs and lots
>  of source code but I haven't found the answer.

The correct way to do it is as follows:

	GtkArg arg;
	double text_width;

	arg.name = "text_width";
	gtk_object_getv (GTK_OBJECT (my_text_item), 1, &arg);
	text_width = GTK_VALUE_DOUBLE (arg);

The canvas items use the object argument system.  You were trying to
use the dataset system instead :-)

  Federico



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