uEZ GUI Start Here Guide
UEZGUI-1788-56VI
Rev. 1.11 Aug 31, 2016
Page 26
3.
Add a line in both of the local data arrays for the new back button.
4.
Create the callback function for switching back to the home screen by adding the
associated handling function to the file below the local data arryas.
5.
Add the function prototype after the “Global Data” section at the top of the file.
6.
Use the appropriate steps to Build, download, debug, and run the updated project
to test the new functionality.
/*---------------------------------------------------------------------------*
* Local Data:
*---------------------------------------------------------------------------*/
/** Structure to hold all of the widgets used in this dialog*/
static
const
GUI_WIDGET_CREATE_INFO _iSecondScreenDialog
[]
=
{
//Function, Name, ID, XP, YP, XS, YS
{
WINDOW_CreateIndirect
,
""
,
ID_WINDOW
,
WINDOW_XPOS
,
WINDOW_YPOS
,
WINDOW_XSIZE
,
WINDOW_YSIZE
,
0
,
0
,
0
},
{
TEXT_CreateIndirect
,
""
,
ID_TITLE_TEXT
,
TITLE_TEXT_XPOS
,
TITLE_TEXT_YPOS
,
TITLE_TEXT_XSIZE
,
TITLE_TEXT_YSIZE
,
TEXT_CF_HCENTER
|
TEXT_CF_VCENTER
,
0
,
0
},
{
TEXT_CreateIndirect
,
""
,
ID_TEMP_TEXT
,
TEMP_TEXT_XPOS
,
TEMP_TEXT_YPOS
,
TEMP_TEXT_XSIZE
,
TEMP_TEXT_YSIZE
,
TEXT_CF_HCENTER
|
TEXT_CF_VCENTER
,
0
,
0
},
{
BUTTON_CreateIndirect
,
""
,
ID_BACK_BUTTON
,
BACK_BUTTON_XPOS
,
BACK_BUTTON_YPOS
,
BACK_BUTTON_XSIZE
,
BACK_BUTTON_YSIZE
,
TEXT_CF_HCENTER
|
TEXT_CF_VCENTER
,
0
,
0
},
};
/** Generic Mapping of Screen Layout*/
static
T_LAFMapping SecondScreenMapping
[]
=
{
{
ID_WINDOW
,
""
,
GUI_BLACK
,
GUI_WHITE
,
&
FONT_SMALL
,
LAFSetupWindow
,
0
},
{
ID_TITLE_TEXT
,
"Temperature Screen"
,
GUI_BLACK
,
GUI_WHITE
,
&
FONT_LARGE
,
LAFSetupText
,
0
},
{
ID_TEMP_TEXT
,
"Temp"
,
GUI_BLACK
,
GUI_WHITE
,
&
FONT_LARGE
,
LAFSetupText
,
0
},
{
ID_BACK_BUTTON
,
"Back"
,
GUI_GRAY
,
GUI_BLACK
,
&
FONT_LARGE
,
LAFSetupButton
,
(TBool (*)(WM_MESSAGE *, int, int)) IHandleBackButton
},
{
0
},
};
/*-------------------------------------------------------------------------*
* Routine: IHandleBackButton
*-------------------------------------------------------------------------*
* Description:
* Change to the home screen when the back button is pressed.
*-------------------------------------------------------------------------*/
static
TBool IHandleBackButton
(
WM_MESSAGE
*
pMsg
,
int
aNCode
,
int
aID
)
{
if
(
aNCode
==
WM_NOTIFICATION_RELEASED
)
{
WindowManager_Show_Window
(
HOME_SCREEN
);
}
return
EFalse
;
}
/*-------------------------------------------------------------------------*
* Function Prototypes:
*-------------------------------------------------------------------------*/
static
TBool IHandleBackButton(WM_MESSAGE * pMsg, int aNCode, int aID);