Skip to content

Commit 2edabac

Browse files
committed
6.9.2a
Updated examples for QWin: dpp-gui and game-gui to show the use of edit controls
1 parent 0b21547 commit 2edabac

File tree

4 files changed

+43
-16
lines changed

4 files changed

+43
-16
lines changed
450 Bytes
Binary file not shown.

Diff for: examples/arm-cm/dpp_efm32-slstk3401a/win32-gui/bsp.c

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*****************************************************************************
22
* Product: DPP example, Win32-GUI
3-
* Last updated for version 6.8.0
4-
* Last updated on 2020-03-31
3+
* Last updated for version: 6.9.3
4+
* Date of the Last Update: 2021-03-03
55
*
66
* Q u a n t u m L e a P s
77
* ------------------------
88
* Modern Embedded Software
99
*
10-
* Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved.
10+
* Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved.
1111
*
1212
* This program is open source software: you can redistribute it and/or
1313
* modify it under the terms of the GNU General Public License as published
@@ -146,6 +146,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
146146
/* --> QP: spawn the application thread to run main_gui() */
147147
Q_ALLEGE(CreateThread(NULL, 0, &appThread, NULL, 0, NULL)
148148
!= (HANDLE)0);
149+
150+
SetDlgItemTextA(hWnd, IDC_EDIT1, "Edit1");
151+
SetDlgItemTextA(hWnd, IDC_EDIT2, "Edit2");
149152
return 0;
150153
}
151154

@@ -154,20 +157,29 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
154157
return 0;
155158
}
156159

157-
/* commands from regular buttons and menus... */
160+
/* commands from child controls and menus... */
158161
case WM_COMMAND: {
159-
SetFocus(hWnd);
160162
switch (wParam) {
161163
case IDOK:
162164
case IDCANCEL: {
163165
PostQuitMessage(0);
164166
break;
165167
}
168+
case IDC_PAUSE: { /* owner-drawn button(s) */
169+
SetFocus(hWnd);
170+
break;
171+
}
172+
case IDC_BUTTON1: { /* regular button */
173+
char buf[32];
174+
GetDlgItemTextA(hWnd, IDC_EDIT1, buf, sizeof(buf));
175+
SetDlgItemTextA(hWnd, IDC_EDIT2, buf);
176+
break;
177+
}
166178
}
167179
return 0;
168180
}
169181

170-
/* owner-drawn buttons... */
182+
/* drawing of owner-drawn buttons... */
171183
case WM_DRAWITEM: {
172184
LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam;
173185
switch (pdis->CtlID) {

Diff for: examples/arm-cm/dpp_efm32-slstk3401a/win32-gui/resource.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
#define IDC_PHILO_2 1002
1515
#define IDC_PHILO_3 1003
1616
#define IDC_PHILO_4 1004
17+
#define IDC_EDIT1 1005
1718
#define IDC_PAUSE 1006
19+
#define IDC_EDIT2 1007
20+
#define IDC_BUTTON1 1008
1821
#define IDC_PAUSED 1009
1922
#define IDS_APP_TITLE 40000
2023
#define IDS_PAUSED 40001
@@ -26,7 +29,7 @@
2629
#ifndef APSTUDIO_READONLY_SYMBOLS
2730
#define _APS_NEXT_RESOURCE_VALUE 112
2831
#define _APS_NEXT_COMMAND_VALUE 40001
29-
#define _APS_NEXT_CONTROL_VALUE 1002
32+
#define _APS_NEXT_CONTROL_VALUE 1009
3033
#define _APS_NEXT_SYMED_VALUE 123
3134
#endif
3235
#endif

Diff for: examples/arm-cm/game_efm32-slstk3401a/win32-gui/bsp.c

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*****************************************************************************
22
* Product: "Fly 'n' Shoot" game example, EFM32-SLSTK3401A, Win32-GUI
3-
* Last updated for version 6.9.1
4-
* Last updated on 2020-09-22
3+
* Last updated for version 6.9.3
4+
* Last updated on 2021-03-03
55
*
66
* Q u a n t u m L e a P s
77
* ------------------------
88
* Modern Embedded Software
99
*
10-
* Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved.
10+
* Copyright (C) 2005-2021 Quantum Leaps, LLC. All rights reserved.
1111
*
1212
* This program is open source software: you can redistribute it and/or
1313
* modify it under the terms of the GNU General Public License as published
@@ -74,7 +74,9 @@ static void paintBitsClear(uint8_t x, uint8_t y,
7474
PLAYER_TRIGGER = QS_USER,
7575
COMMAND_STAT
7676
};
77-
static uint8_t const l_clock_tick = 0U;
77+
78+
/* QSpy source IDs */
79+
static QSpyId const l_clock_tick = { 0U };
7880
#endif
7981

8082
/* Local functions ---------------------------------------------------------*/
@@ -752,25 +754,29 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
752754
return 0;
753755
}
754756

755-
/* commands from regular buttons and menus... */
757+
/* commands from child controls and menus... */
756758
case WM_COMMAND: {
757-
SetFocus(hWnd);
758759
switch (wParam) {
759760
case IDOK:
760761
case IDCANCEL: {
761762
OutputDebugString("QUIT\n");
762763
PostQuitMessage(0);
763764
break;
764765
}
766+
case IDC_USER0: /* owner-drawn buttons... */
767+
case IDC_USER1: {
768+
SetFocus(hWnd);
769+
break;
770+
}
765771
}
766772
return 0;
767773
}
768774

769-
/* owner-drawn buttons... */
775+
/* drawing of owner-drawn buttons... */
770776
case WM_DRAWITEM: {
771777
LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam;
772778
switch (pdis->CtlID) {
773-
case IDC_USER0: { /* USER owner-drawn Button0 */
779+
case IDC_USER0: { /* owner-drawn Button0 */
774780
OutputDebugString("USER0\n");
775781
switch (OwnerDrawnButton_draw(&l_userBtn0, pdis)) {
776782
case BTN_DEPRESSED: {
@@ -788,9 +794,15 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
788794
}
789795
break;
790796
}
791-
case IDC_USER1: { /* USER owner-drawn Button1 */
797+
case IDC_USER1: { /* owner-drawn Button1 */
792798
OutputDebugString("USER1\n");
793799
switch (OwnerDrawnButton_draw(&l_userBtn1, pdis)) {
800+
case BTN_DEPRESSED: {
801+
break;
802+
}
803+
case BTN_RELEASED: {
804+
break;
805+
}
794806
default: {
795807
break;
796808
}

0 commit comments

Comments
 (0)