2 categories:: GUI, Common methods
3 summary:: Create a Graphical User Interface
4 related:: Classes/ObjectGui
7 The code::gui:: message is of common use in SC. It originated in the crucial library where it is used to create an link::Classes/ObjectGui:: or an ObjectGui subclass as part of a Model View Controller system.
9 The implementation and accepted arguments to .gui varies. This helpfile explains the default behavior of Object and hence of all Object subclasses that haven't implemented their own .gui method. This helpfile and the implementation come from the original crucial library.
11 Any object can create a GUI, albeit a very simple one that just displays the object's string representation on a view:
20 This means that any object can be .gui(ed) without knowing exactly what the object is. This is identical in purpose to .asString which is used for posting an object's representation to the post window.
23 section:: Argument conventions
25 The convention as stated in crucial library states that the .gui method should accept parent and bounds as its arguments in the same manner as a View does.
28 thing.gui(parent,bounds);
29 // or with optional additional arguments:
30 things.gui(parent,bounds,arg1,arg2,...argN)
33 This convention hasn't been followed by many who have written their own .gui methods (perhaps calling it that rather than .makeView or .makeWindow because they liked that .gui was nice and short to type)
35 This is the default implementation for Object, and is thus the implementation for all subclasses that have not written an explicit .gui method
45 ## nil (which will create a Window with a FlowView on it)
49 ## anything that responds to asRect:
50 ## Nil - the gui will use its own default size
51 ## Point - width @ height
55 Usually the bounds are not specified. The object's gui class first adds a container, lays its things inside that container and then shrinks the container to fit it. If you do specify a bounds, the container will be set to exactly that size.
57 Add a view to a parent view (window)
70 Each class can specify an associated guiClass, which is a subclass of ObjectGui.
71 Writing useful subclasses is the purpose of the ObjectGui system and many can be found in the crucial library.
73 Examples specifying guiClass:
76 Object-guiClass { ^ObjectGui }
77 Server-guiClass { ^ServerGui }
78 AbstractPlayer-guiClass { ^AbstractPlayerGui }
79 Patch-guiClass { ^PatchGui }
82 For any class where it is appropriate, a separate gui class is implemented, usually inheriting much of its behavior from the gui class of its superclass.
84 see link::Classes/ObjectGui::