1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
Data Attributes of Objects
Wpy adds a number of data attributes to the objects it uses. All these
attributes start with "wpy" to prevent name collisions with user-defined
data attributes. You may need to write to these attributes to control
wpy. Some of the data is more or less standard, while certain objects
have special data attributes.
These are the standard data attributes for most visible objects.
wpyText Text to appear as window titles or control text.
wpyParent The parent of the object.
wpyChildList The list of children of the object, or an empty list.
wpySizeX, Y The requested width and height of the object (see Geometry).
wpyLocX, Y The requested location of the object within its parent (see Geometry).
wpyAnchor The point of the object which should placed at wpyLocX/Y. A
compass string n, ne, e, se, s, sw, w, nw, or center.
wpyVisible For controls, 0/1 if the object is invisible/visible.
wpyEnabled For controls, 0/1 if the object is disabled/enabled.
wpyCharSizeX, Y The size of the system font in pixels. See Geometry.
wpyScreenSizeX, Y The screen size in pixels.
wpyOneMeter The number of pixels in one meter on the screen.
wpyCreated Is 0/1 if the object is not created/created by the underlying GUI.
wpyHandler For controls, the name of the message handler.
wpyMenu The menu for the object, or None.
wpyApp The single application object.
To find out about more specialized attributes, you must read the wpy.py source,
or the documentation for each class.
Parent and Child Relationships
It is often necessary to access an object from another object, for example,
to find the document given the view. To support this, objects have an attribute
"wpyParent" which gives the parent of the object, and a "wpyChildList" listing
the descendants of the object. Here are the parents and child lists for
common objects:
Object wpyParent wpyChildList
CWinApp None Document templates
template CWinApp documents
documents template frames
frame document views
view frame controls if any
menu None menu items
These objects have special parent/child attributes:
Object Attribute Description
document wpyViewList A list of views for this document
CWinApp wpyMainFrame The main window for the application, a frame
main frame wpyWindowList A list of windows for the main frame (MDI)
view wpyDocument The document shown by this view.
Most objects in WPY are derived from CObject. Since there is only one
CWinApp object in any WPY application, the app object is a data attribute
of CObject. The application object is available from (almost)
any WPY object as self.wpyApp.
There is a concept of the active frame, document and view. Use the
methods CFrameWnd::GetActiveDocument(), CFrameWnd::GetActiveView(),
CWinApp::GetActiveFrame() and CWinApp::GetActiveFrameDV().
|