Re: gtk_object_get_data



You don't use the gtk_object_get_data function for this.  That function is
for getting arbitrary data associated with an object by
gtk_object_set_data.  You probably want to be using gtk_object_getv.  The
code should look something like this:

  GtkArg arg;

  arg.type = GTK_TYPE_DOUBLE;
  arg.name = "text_width";
  gtk_object_getv(GTK_OBJECT(item), 1, &arg);
  text_width = GTK_VALUE_DOUBLE(arg);

This should give you the width (in pixels) of the rendered text.

James Henstridge.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/


On Fri, 12 Feb 1999, Richard Hult wrote:

> 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.
> 
> Thanks
> Richard
> 
> 
> -- 
> To unsubscribe: mail gnome-devel-list-request@gnome.org with "unsubscribe"
> as the Subject.
> 



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