Re: Properties, what are they for? Wigets writing doubts.



On Thu, 2006-09-14 at 18:30 +0000, Alexandre wrote:
  Hi everyone.

  I'm beginning in widget's writing, and I want to know what is the
purpose of the  widgets properties. Because, when I look at the gtk
widgets, they  have a lot of properties, but this properties can be
changed with the gtk_name_set.. functions too..
  Like the frame, is has a "label" property to change it's label, but
it can be done with the gtk_frame_set_label (or anything like it), so,
why use properties?

gtk_frame_set_label() is a bare wrapper function for the set_property
call; it's a pure convenience method. The reason we use properties is
because it's OO; subclassed widgets can override the property accessors.

Also, it's useful for bindings; e.g. in pygtk <object>.props gives the
collection of the object's properties. Without the formalism of GObject
properties that wouldn't be possible.

Ed




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