Next: 9 Using ids Up: GNUstep Renaissance Previous: 7 Adding a button

8 Another small example of using the file owner

Another example of using the #NSOwner syntax is when you want to set the delegate of an interface object (for example, of a window) to be your file owner. To do so, you just add the attribute delegate="#NSOwner" to the corresponding tag; for example, the following gsmarkup file:
<gsmarkup>
  <objects>
    <window title="My Window" delegate="#NSOwner" />
  </objects>
</gsmarkup>
creates a window with title My Window, and sets the window delegate to be the file owner (that is, the object which is passed as the owner argument to the loadGSMarkupNamed:owner: call used to load the file). The delegate is informed of basic events in the window life (such as the window being miniaturized, or closed, or made key), and can modify the window behaviour; please refer to the GNUstep documentation for more information on delegates.



2008-01-16