State Bits of Graphic Objects
State Bits
Every graphics object has several state bits. The state bits are combined together into one word and stored in the object's data structure. State bits fall into one of two different categories:
The first category informs the drawing function, GFX_GOL_ObjectListDraw, to copy the entire object, or a portion of the object, to the frame buffer.
The second category of status bits informs GFX_GOL_ObjectListDraw how to draw the object. When an object is being copied to the frame-buffer some of the state bits inform GFX_GOL_ObjectListDraw which elements from the style scheme are to be applied to the object.
State Bits used to Draw or Re-draw an Object
GOL_OBJ_xxxx_DRAW_STATE and GOL_OBJ_xxxx_DRAW_UPDATE_STATE are the state bits used to determine if an object is to be drawn or redrawn to the frame buffer.
All objects have a DRAW state bit. When this bit is set, the entire object is written (or re-written) to the frame buffer. Typically, the user program sets the DRAW bit when a situation occurs in which the entire object needs to be redrawn.
Some objects have an UPDATE status bit in addition to the DRAW bit. When the update bit is set by the user application, only the portion of the object which contains data (such as the value on the meter object) will be re-drawn to the frame buffer. Using the UPDATE bit will help reduce the visual "jitter" that some people notice when an entire object is redrawn.
Object | DRAW State bit | UPDATE State bit |
---|---|---|
Button | GFX_GOL_BUTTON_DRAW_STATE | n/a |
Meter | GFX_GOL_METER_DRAW_STATE | GFX_GOL_METER_UPDATE_DRAW |
Scroll Bar | GFX_GOL_SCROLLBAR_DRAW_STATE | GFX_GOL_SCROLLBAR_THUMB_DRAW_STATE |
Static Text Box | GFX_GOL_STATICTEXT_DRAW_STATE | n/a |
Progress Bar | GFX_GOL_PROGRESSBAR_DRAW_STATE | GFX_GOL_PROGRESSBAR_DRAW_BAR_STATE |
State Bits Used to Control an Object's Appearance
In addition to the draw and update state bits, Graphics objects each have the following bits:
- GFX_GOL_xxxx_DISABLED: Draws the object with ColorDisabled and TextColorDisabled
- GOLgfx_xxxx_HIDE: Draws the object with the CommonBkColor from the style scheme, making the object non-visible
- GFX_GOL_xxxx_FOCUS: Applies a focus element to the object
In addition to the draw and update state bits, each object type has some states unique to that object. These unique state bits reflect conditions applicable to those objects. Comparison of the state bits for a Button object and a Scroll-bar object reveals some of the differences:
Button States | Scroll-bar States |
Object Specific States in yellow: |
The function and effect of setting the object-specific state bits vary from object to object. This tutorial will show you the procedures used to set and clear state bits. Refer to the help file to learn about the attributes of object-specific state bits.