WM Untouchable Window (Sample)
WM_SetUntouchable.c | |
---|---|
File(s) required |
|
Runs in simulation | Yes |
Runs on target | Yes |
Download | WM_SetUntouchable.c |
This sample demonstrates how a window in emWin can be made untouchable. When this is done, all touch input will be redirected to the window(s) below the untouchable window.
Demo
Code
/*********************************************************************
* SEGGER Microcontroller GmbH *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2020 SEGGER Microcontroller GmbH *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V6.10 - Graphical user interface for embedded applications **
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with a license and should not be re-
distributed in any way. We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : WM_SetUntouchable.c
Purpose : Sample that shows how to create untouchable windows.
Requirements: WindowManager - (x)
MemoryDevices - ( )
AntiAliasing - ( )
VNC-Server - ( )
PNG-Library - ( )
TrueTypeFonts - ( )
---------------------------END-OF-HEADER------------------------------
*/
#include "DIALOG.h"
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
/*********************************************************************
*
* _cbWin0
*/
static void _cbWin(WM_MESSAGE * pMsg) {
GUI_RECT Rect;
switch (pMsg->MsgId) {
case WM_PAINT:
//
// Draw something
//
WM_GetClientRect(&Rect);
GUI_SetColor(GUI_RED);
GUI_DrawRectEx(&Rect);
GUI_SetColor(GUI_BLUE);
GUI_SetFont(&GUI_Font32B_1);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_DispStringInRect("UNTOUCHABLE", &Rect, GUI_TA_LEFT | GUI_TA_VCENTER);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void MainTask(void) {
WM_HWIN hWin;
//
// Init emWin.
//
GUI_Init();
WM_SetDesktopColor(GUI_WHITE);
//
// Create a button.
//
BUTTON_CreateEx(30, 20, 100, 30, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
//
// Create a window that is above the button.
//
hWin = WM_CreateWindow(10, 10, 250, 50, WM_CF_SHOW | WM_CF_HASTRANS, _cbWin, 0);
//
// Mark the window as 'untouchable', so all touch events get routed to the window below it.
//
WM_SetUntouchable(hWin, 1);
while (1) {
GUI_Delay(100);
}
}
/*************************** End of file ****************************/