githubEdit

GuiManager

Introduction

The GuiManager is a static object responsible for common UI element management as well as some UI creation. There are two categories of UI elements:

  1. Default FlatRedBall GUI objects which are usually used for debugging and tools (these are used in all FRB graphical tools like the SpriteEditor, PolygonEditor, etc)

  2. Gluearrow-up-right Entities inheriting from IWindowarrow-up-right

For a Default FlatRedBall UI element to be visible and functional it must either belong to the GuiManager or another UI element. Gluearrow-up-right Entities are drawn by the engine like normal Entities - the GuiManager simply handles the cursor-based activity (like clicks).

Window Categories

When a Windowarrow-up-right is created and added to the GuiManager, it can be added to one of three internal lists. These lists define the three categories. These categories are:

  • Regular

  • Dominant

  • Perishable

The following sections define the characteristics of each category.

Regular

Adding a Windowarrow-up-right by calling its constructor then passing it to the GuiManager's AddWindow method will add the Windowarrow-up-right as a regular Windowarrow-up-right. Regular Windowsarrow-up-right remain in memory until they are removed using the GuiManager's RemoveWindow method. Making a regular Windowarrow-up-right invisible will not remove it from the GuiManager.

Dominant

Dominant Windowsarrow-up-right are Windowsarrow-up-right which consume Cursorarrow-up-right interaction while they are visible. In other words, if a dominant Windowarrow-up-right is present, no other Windowsarrow-up-right will receive input. Any Windowarrow-up-right can be made dominant through the AddDominantWindowarrow-up-right method. Dominant Windowsarrow-up-right are often used when the users attention is required on a particular Windowarrow-up-right. Examples include a OkCancelWindowarrow-up-right asking if the program should really exit after clicking the close button or a FileWindowarrow-up-right for selecting a file to load in an application. Dominant Windowsarrow-up-right can be removed by either calling the GuiManager's RemoveWindow method or by setting the dominant Window'sarrow-up-right Visible property to false. Setting the Visible property to false will result in the GuiManager automatically removing the Windowarrow-up-right if RemoveInvisibleDominantWindowsarrow-up-right is set to true.

Perishable

Perishable Windowsarrow-up-right are Windowsarrow-up-right which will automatically be removed by the GuiManager when the user clicks and the Cursor is not over the perishable Windowarrow-up-right. Perishable Windows are most commonly used for Windows which have a short life span. Examples include the drop-down ListBoxes that appear when clicking the Buttonarrow-up-right on ComboBoxesarrow-up-right or menus appearing when right-clicking on an object. If the user clicks on a perishable Windowarrow-up-right, the Windowarrow-up-right will not automatically remove itself. The removal is usually handled in one of the Window'sarrow-up-right events in this case.

GuiManager Members

Did this article leave any questions unanswered? Post any question in our forumsarrow-up-right for a rapid response.

Last updated

Was this helpful?