Skip to content

Commit cb2725e

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

File tree

4 files changed

+39
-18
lines changed

4 files changed

+39
-18
lines changed
450 Bytes
Binary file not shown.

examples/arm-cm/dpp_efm32-slstk3401a/win32-gui/bsp.cpp

Lines changed: 18 additions & 6 deletions
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.9.1
4-
// Date of the Last Update: 2020-09-21
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
@@ -153,6 +153,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
153153
// --> QP: spawn the application thread to run main()
154154
Q_ALLEGE(CreateThread(NULL, 0, &appThread, NULL, 0, NULL)
155155
!= (HANDLE)0);
156+
157+
SetDlgItemTextA(hWnd, IDC_EDIT1, "Edit1");
158+
SetDlgItemTextA(hWnd, IDC_EDIT2, "Edit2");
156159
return 0;
157160
}
158161

@@ -161,20 +164,29 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
161164
return 0;
162165
}
163166

164-
// commands from regular buttons and menus...
167+
/* commands from child controls and menus... */
165168
case WM_COMMAND: {
166-
SetFocus(hWnd);
167169
switch (wParam) {
168170
case IDOK:
169171
case IDCANCEL: {
170172
PostQuitMessage(0);
171173
break;
172174
}
175+
case IDC_PAUSE: { // owner-drawn button(s)
176+
SetFocus(hWnd);
177+
break;
178+
}
179+
case IDC_BUTTON1: { // regular button
180+
char buf[32];
181+
GetDlgItemTextA(hWnd, IDC_EDIT1, buf, sizeof(buf));
182+
SetDlgItemTextA(hWnd, IDC_EDIT2, buf);
183+
break;
184+
}
173185
}
174186
return 0;
175187
}
176188

177-
// owner-drawn buttons...
189+
// drawing of owner-drawn buttons...
178190
case WM_DRAWITEM: {
179191
static QP::QEvt const pe = QEVT_INITIALIZER(PAUSE_SIG);
180192
LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam;

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

Lines changed: 4 additions & 1 deletion
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

examples/arm-cm/game_efm32-slstk3401a/win32-gui/bsp.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
///***************************************************************************
22
// Product: "Fly 'n' Shoot" game example for Win32-GUI
3-
// Last updated for version 6.9.1
4-
// Last updated on 2020-09-21
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. All rights reserved.
10+
// Copyright (C) 2005-2021 Quantum Leaps. 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
@@ -93,8 +93,10 @@ static void playerTrigger(void);
9393
COMMAND_STAT
9494
};
9595
static SOCKET l_sock = INVALID_SOCKET;
96-
static uint8_t const l_clock_tick = 0U;
97-
static uint8_t const l_mouse = 0U;
96+
97+
// QS source IDs
98+
static QP::QSpyId const l_clock_tick = { 0U };
99+
static QP::QSpyId const l_mouse = { 0U };
98100
#endif
99101

100102
// Local functions -----------------------------------------------------------
@@ -728,25 +730,29 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
728730
return 0;
729731
}
730732

731-
// commands from regular buttons and menus...
733+
// commands from child controls and menus...
732734
case WM_COMMAND: {
733-
SetFocus(hWnd);
734735
switch (wParam) {
735736
case IDOK:
736737
case IDCANCEL: {
737738
OutputDebugString("QUIT\n");
738739
PostQuitMessage(0);
739740
break;
740741
}
742+
case IDC_USER0: // owner-drawn buttons...
743+
case IDC_USER1: {
744+
SetFocus(hWnd);
745+
break;
746+
}
741747
}
742748
return 0;
743749
}
744750

745-
// owner-drawn buttons...
751+
// drawing of owner-drawn buttons...
746752
case WM_DRAWITEM: {
747753
LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam;
748754
switch (pdis->CtlID) {
749-
case IDC_USER0: { // USER owner-drawn Button0
755+
case IDC_USER0: { // owner-drawn Button0
750756
OutputDebugString("USER0\n");
751757
switch (OwnerDrawnButton_draw(&l_userBtn0, pdis)) {
752758
case BTN_DEPRESSED: {
@@ -764,7 +770,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
764770
}
765771
break;
766772
}
767-
case IDC_USER1: { // USER owner-drawn Button1
773+
case IDC_USER1: { // owner-drawn Button1
768774
OutputDebugString("USER1\n");
769775
switch (OwnerDrawnButton_draw(&l_userBtn1, pdis)) {
770776
case BTN_DEPRESSED: {
@@ -776,7 +782,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg,
776782
default: {
777783
break;
778784
}
779-
}
785+
}
780786
break;
781787
}
782788
}

0 commit comments

Comments
 (0)