State Bits of Graphic Objects

Last modified by Microchip on 2023/11/10 11:03

This page contains information for the Graphics Library found in Microchip Libraries for Applications (MLA). It is not relevant for the MPLAB® Harmony Graphics Library.

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.

Examples of the GFX_GOL_ObjectListDraw applying a style scheme to an object based on the state bits are covered in the "Drawing Graphics Objects" Developer Help page.

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.

The "xxxx" in the state bit names above are representative of the type of object to be drawn. There are no state bits with an xxxx in their name.

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.

ObjectDRAW State bitUPDATE State bit
ButtonGFX_GOL_BUTTON_DRAW_STATEn/a
MeterGFX_GOL_METER_DRAW_STATEGFX_GOL_METER_UPDATE_DRAW
Scroll BarGFX_GOL_SCROLLBAR_DRAW_STATEGFX_GOL_SCROLLBAR_THUMB_DRAW_STATE
Static Text BoxGFX_GOL_STATICTEXT_DRAW_STATEn/a
Progress BarGFX_GOL_PROGRESSBAR_DRAW_STATEGFX_GOL_PROGRESSBAR_DRAW_BAR_STATE

​The above table contains only a partial listing of the available state bits. To get a complete list the state-bits for all objects, open GFX_help.png elp_mlagfx.jar located in …microchip/mla/vYYYY_MM_DD/doc…

Back to top

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

The "xxxx" in the update-state bit names above are representative of the type of object to be drawn. There are no state bits with an xxxx in their names. Examples include names such as: GFX_GOL_BUTTON_DISABLE, GFX_GOL_METER_HIDE, etc…

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 StatesScroll-bar States
Button State BitsScrollbar State Bits
Object Specific States in yellow:Yellow Bar

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.

Examples of programming changes to the state bits of the object are covered in the "Changing the State of Graphics Objects" Developer Help page. 

Learn More

Back to top