Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Widget view and extent

The widget view is responsible for rendering the model's data to the display. To do this, the view listens for model notifications that indicate the data has been updated. When a change occurs in the model, or an event is received that causes a change in the presentation of the widget, the view sends an invalidation request to its parent container.

Widget extent

The size of the content area is referred to as the widget's extent. This information is given to the widget by the application or container. 

Note: It's a good idea to set the extent of a widget before inserting it in a container that does not adjust the extent automatically. This includes containers such as XY Container and Root Container. Containers such as Prop Container and Constraint Container may set the extent as soon as the widget is inserted.

The extent is used when sending an invalidation request and during the drawing phase. One of the parameters that can be sent in the invalidation request is the invalid region/rectangle of the widget, which is useful when only part of the extent needs to be redrawn. The invalid rectangle is relative to the parent container's coordinates, so the rectangle is adjusted and passed to the parent's parent, where the process repeats until the request is delivered to the root container. The position of the widget within its parent container is not known by the child; it is maintained by its parent container, and a widget is unable to set it.