MHGC does not have options within the tool to make a widget persistent across different screens.
However, you can modify the generated code to make widgets persistent, and reuse them to screens when the screens are shown.
To do this:
1. In MHGC, create a 'template' screen with the widgets that you would like to reuse across different screens.
2. In MHGC, for each of the screen that will have this widget, enable the 'On Show' and 'On Hide' screen events. You can do this in the Event Manager (Tools -> Event Manager), Screen Events, check the On Show and On Hide Events for the relevant screens. For each On Show/On Hide event, enable a Custom Action.
3. Regenerate the project.
4. Now in libaria_init.c, in the ScreenCreate_*() function for the template screen, CUT (not copy) the code that creates the widgets that you want to reuse in different screens. PASTE that code into the libaria_initialize() function in libaria_init.c. Remove/Comment out the laWidget_AddChild() calls for each of those widgets. The code would look something like this :
//Create persistent widgets
LogoWidget = laImageWidget_New();
laWidget_SetPosition((laWidget*)LogoWidget, 151, 48);
laWidget_SetSize((laWidget*)LogoWidget, 184, 136);
// laWidget_AddChild((laWidget*)layer0, (laWidget*)LogoWidget);
TitleLabel = laLabelWidget_New();
laWidget_SetPosition((laWidget*)TitleLabel, 71, 18);
laWidget_SetSize((laWidget*)TitleLabel, 343, 25);
// laWidget_AddChild((laWidget*)layer0, (laWidget*)TitleLabel);
5. Now for each screen where you want to show these widgets, add the widgets as child to the screen by calling laWidget_AddChild() in the *_ShowEvent() function for each screen. This function is in the libaria_events.c file. It would look like the code below if adding the widgets to the first layer (layers) in the screen. Change the layers index if adding to a different layer in a multi-layer design.
// screen1 - ShowEvent
void screen1_ShowEvent(laScreen* scr)
// Custom Action
6. The widgets will need to be removed as child to the parent screen when the screen is hidden. This is important to preserve the widgets, otherwise they will be deleted/destroyed when their parent screen is hidden. To remove the widget from the parent screen, call the laWidget_RemoveChild() function in the *_HideEvent() function for the relevant screen. It would look like this:
// screen1 - HideEvent
void screen1_HideEvent(laScreen* scr)
// Custom Action
The process above lets you create persistent widgets that you can add/remove from screens to make them appear in each of those screens. Note that the widgets are 'reused', not duplicated. So the states and memory used for those widgets are preserved even when changing screens. A widget that has changed in one screen will retain those changes when shown on another screen. Also, the memory used by those widgets are not freed during screen transitions and will carve out a persistent allocation from the project heap.