Package: gobject

Function g-object-data

Lambda List

g-object-data (object key)

Syntax

(g-object-data object key) => data
(setf (g-object-data object key) data)

Arguments

object -- a g-object instance containing the associations
key -- a string with the name of the key
data -- a pointer as data to associate with that key

Details

Each object carries around a table of associations from strings to pointers. The g-object-data function gets a named field from the objects table of associations. The (setf g-object-data) function sets an association. If the object already had an association with that name, the old association will be destroyed.

Examples

Set an integer as a pointer for a property on a gtk-button widget.
(defvar button (make-instance 'gtk-button))
=> BUTTON
(setf (g-object-data button "property") (make-pointer 100))
=> #.(SB-SYS:INT-SAP #X00000064)
(g-object-data button "property")
=> #.(SB-SYS:INT-SAP #X00000064)
(pointer-address *)
=> 100    
 

See also

*2021-10-24