Some lists were not auto reading results. Hopefully fixed.
This commit is contained in:
1 parent
0f59809e9a
commit
d9aa40e16c
6 files changed
+151
-4
No files matched your search
@@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#include <windows.h>
|
||||
|
||||
static HWND list, button;
|
||||
static int step;
|
||||
|
||||
static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM lp) {
|
||||
if (message == WM_TIMER) {
|
||||
switch (++step) {
|
||||
case 1: case 2: SendMessageW(list, WM_KEYDOWN, VK_DOWN, 1); break;
|
||||
case 3: SendMessageW(list, WM_KEYDOWN, VK_UP, 1); break;
|
||||
case 4: SetFocus(button); break;
|
||||
case 5:
|
||||
// A background change must not be announced or steal focus.
|
||||
SendMessageW(list, LB_INSERTSTRING, 0, (LPARAM)L"Background-only map");
|
||||
SendMessageW(list, LB_SETCURSEL, 0, 0);
|
||||
NotifyWinEvent(EVENT_OBJECT_VALUECHANGE, list, OBJID_CLIENT, CHILDID_SELF);
|
||||
break;
|
||||
case 6:
|
||||
if (GetFocus() != button) return 0;
|
||||
SendMessageW(list, LB_DELETESTRING, 0, 0);
|
||||
SendMessageW(list, LB_SETCURSEL, 0, 0);
|
||||
SetFocus(list);
|
||||
break;
|
||||
case 7: SendMessageW(list, LB_RESETCONTENT, 0, 0); break;
|
||||
default: DestroyWindow(window);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (message == WM_DESTROY) { PostQuitMessage(0); return 0; }
|
||||
return DefWindowProcW(window, message, wp, lp);
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous, LPSTR args, int show) {
|
||||
(void)previous; (void)args; (void)show;
|
||||
WNDCLASSW cls = {0};
|
||||
cls.hInstance = instance;
|
||||
cls.lpszClassName = L"WineAccessListBoxFixture";
|
||||
cls.lpfnWndProc = window_proc;
|
||||
RegisterClassW(&cls);
|
||||
HWND window = CreateWindowW(cls.lpszClassName, L"Select map", WS_OVERLAPPEDWINDOW,
|
||||
120, 120, 600, 300, NULL, NULL, instance, NULL);
|
||||
CreateWindowW(L"Static", L"Tutorial maps", WS_CHILD | WS_VISIBLE,
|
||||
10, 10, 550, 30, window, NULL, instance, NULL);
|
||||
list = CreateWindowW(L"ListBox", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP | LBS_NOTIFY,
|
||||
10, 50, 550, 160, window, NULL, instance, NULL);
|
||||
button = CreateWindowW(L"Button", L"OK", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
|
||||
10, 220, 100, 30, window, NULL, instance, NULL);
|
||||
SendMessageW(list, LB_ADDSTRING, 0, (LPARAM)L"First map");
|
||||
SendMessageW(list, LB_ADDSTRING, 0, (LPARAM)L"Second map β");
|
||||
SendMessageW(list, LB_ADDSTRING, 0, (LPARAM)L"Third map");
|
||||
SendMessageW(list, LB_SETCURSEL, 0, 0);
|
||||
ShowWindow(window, SW_SHOW);
|
||||
SetForegroundWindow(window);
|
||||
SetFocus(list);
|
||||
SetTimer(window, 1, 500, NULL);
|
||||
MSG message;
|
||||
while (GetMessageW(&message, NULL, 0, 0) > 0) {
|
||||
TranslateMessage(&message); DispatchMessageW(&message);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user