Skip to content

Commit 4d51cc5

Browse files
committed
Tweaked child control naming
1 parent 29d9d50 commit 4d51cc5

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

main.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ struct BobWindow
2323

2424
enum class Ctrl : int
2525
{
26-
Id1 = 1,
27-
Id2 = 2,
28-
Id3 = 3,
29-
Id4 = 4,
30-
Id5 = 5,
31-
Id6 = 6
26+
Btn1 = 1,
27+
Btn2 = 2,
28+
TxtDbl1 = 3,
29+
TxtDbl2 = 4,
30+
BtnConverge = 5,
31+
TxtEpsilon = 6
3232
};
3333

3434
int msg_box(HWND hWnd, LPCWSTR msg, LPCWSTR title, UINT btns = MB_OK)
@@ -134,7 +134,7 @@ void btn2_click(HWND hWnd)
134134
show_file_open(hWnd);
135135
}
136136

137-
void btn5_click(HWND hWnd){
137+
void btnConverge_click(HWND hWnd){
138138
converged(hWnd);
139139
}
140140

@@ -220,35 +220,35 @@ LRESULT CALLBACK window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
220220
auto id {(Ctrl)LOWORD(wParam)};
221221
switch (id)
222222
{
223-
case Ctrl::Id1:
223+
case Ctrl::Btn1:
224224
{
225225
btn1_click(hwnd);
226226
break;
227227
}
228-
case Ctrl::Id2:
228+
case Ctrl::Btn2:
229229
{
230230
btn2_click(hwnd);
231231
break;
232232
}
233-
case Ctrl::Id5:
233+
case Ctrl::BtnConverge:
234234
{
235-
btn5_click(hwnd);
235+
btnConverge_click(hwnd);
236236
}
237237
}
238-
//ignore 3 and 4, which are textboxes
238+
//ignore textboxes for now
239239
return 0;
240240
}
241241
case WM_CREATE:
242242
{
243243
CREATESTRUCT *pCreate {reinterpret_cast<CREATESTRUCT *>(lParam)};
244244
BobWindow *pData = static_cast<BobWindow *>(pCreate->lpCreateParams);
245245
LONG_PTR result {SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pData)};
246-
pData->txt1 = create_txtbox((LPCWSTR)L"1.01", Ctrl::Id3, 115, 100, 100, 25, hwnd);
247-
pData->txt2 = create_txtbox((LPCWSTR)L"1.02", Ctrl::Id4, 315, 100, 100, 25, hwnd);
248-
pData->txtEpsilon = create_txtbox((LPCWSTR)L".001", Ctrl::Id6, 505, 100, 100, 25, hwnd);
249-
create_button((LPCWSTR)L"button1", Ctrl::Id1, 50, 200, 100, 25, hwnd);
250-
create_button((LPCWSTR)L"button2", Ctrl::Id2, 200, 200, 100, 25, hwnd);
251-
create_button((LPCWSTR)L"converge", Ctrl::Id5, 350, 200, 100, 25, hwnd);
246+
pData->txt1 = create_txtbox((LPCWSTR)L"1.01", Ctrl::TxtDbl1, 115, 100, 100, 25, hwnd);
247+
pData->txt2 = create_txtbox((LPCWSTR)L"1.02", Ctrl::TxtDbl2, 315, 100, 100, 25, hwnd);
248+
pData->txtEpsilon = create_txtbox((LPCWSTR)L".001", Ctrl::TxtEpsilon, 505, 100, 100, 25, hwnd);
249+
create_button((LPCWSTR)L"button1", Ctrl::Btn1, 50, 200, 100, 25, hwnd);
250+
create_button((LPCWSTR)L"button2", Ctrl::Btn2, 200, 200, 100, 25, hwnd);
251+
create_button((LPCWSTR)L"converge", Ctrl::BtnConverge, 350, 200, 100, 25, hwnd);
252252
return 0;
253253
}
254254
case WM_DESTROY:

0 commit comments

Comments
 (0)