Difference between revisions of "CHECKBOX - Custom (Sample)"
(Created page with "{| class="wikitable" style="float:right; margin-left: 10px; background-color: #f9f9f9;" ! colspan="2" style="font-weight:bold; font-size:17px; font-family:Arial, Helvetica, sa...") |
|||
Line 20: | Line 20: | ||
This sample demonstrates custom drawing of a CHECKBOX widget. |
This sample demonstrates custom drawing of a CHECKBOX widget. |
||
+ | |||
+ | == Demo == |
||
+ | |||
+ | <html><iframe src="https://wiki.segger.com/demo/emwin/CHECKBOX_Custom/CHECKBOX_Custom.html" width="480" height="272" style="border: 1px #c0c0c0 solid;" marginwidth="0" marginheight="0" hspace="0" vspace="0" scrolling="no"> </iframe></html> |
||
== Code == |
== Code == |
Latest revision as of 16:08, 7 March 2022
CHECKBOX_Custom.c | |
---|---|
File(s) required |
|
Runs in simulation | Yes |
Runs on target | Yes |
Download | CHECKBOX_Custom.c |
This sample demonstrates custom drawing of a CHECKBOX widget.
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 : CHECKBOX_Custom.c
Purpose : Sample that demonstrates the usage of CHECKBOX widgets
in emWin.
Requirements: WindowManager - (x)
MemoryDevices - ( )
AntiAliasing - ( )
VNC-Server - ( )
PNG-Library - ( )
TrueTypeFonts - ( )
---------------------------END-OF-HEADER------------------------------
*/
#include "DIALOG.h"
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
static const CHECKBOX_SKINFLEX_PROPS _PropsEnabled = {
{ GUI_BLUE, GUI_WHITE, GUI_MAGENTA },
{ GUI_GRAY_3F, GUI_GRAY_AA },
GUI_RED,
20
};
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void MainTask(void) {
CHECKBOX_Handle hBox;
//
// Init GUI
//
GUI_Init();
GUI_SetBkColor(GUI_WHITE);
GUI_Clear();
//
// Create checkbox widget
//
hBox = CHECKBOX_CreateEx(10, 10, 100, 50, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_CHECK0);
CHECKBOX_SetText(hBox, "Check");
CHECKBOX_SetBoxBkColor(hBox, GUI_WHITE, CHECKBOX_CI_ENABLED);
//
// Set skinning properties
//
CHECKBOX_SetSkinFlexProps(&_PropsEnabled, CHECKBOX_SKINFLEX_PI_ENABLED);
//
// Manually set the button size property
//
CHECKBOX_SetSkinFlexButtonSize(hBox, 40);
while (1) {
GUI_Delay(100);
}
}
/*************************** End of file ****************************/