2025-10-15 08:46:38 +00:00
|
|
|
#include <Mw/Milsko.h>
|
|
|
|
|
|
2025-10-15 13:58:56 +00:00
|
|
|
#include "../harvard.c"
|
2025-10-15 09:02:23 +00:00
|
|
|
|
2025-10-15 10:32:40 +00:00
|
|
|
MwWidget wmain;
|
2025-10-15 08:46:38 +00:00
|
|
|
|
2025-10-15 10:32:40 +00:00
|
|
|
void destroy(MwWidget handle, void* user, void* call) {
|
2025-10-16 10:45:58 +00:00
|
|
|
(void)handle;
|
|
|
|
|
(void)call;
|
2025-10-16 10:42:59 +00:00
|
|
|
MwMessageBoxDestroy(user);
|
2025-10-15 10:32:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void activate(MwWidget handle, void* user, void* call) {
|
|
|
|
|
char msg[256];
|
|
|
|
|
MwWidget msgbox;
|
2025-10-16 10:52:25 +00:00
|
|
|
|
|
|
|
|
(void)user;
|
|
|
|
|
|
2026-03-30 11:19:10 -07:00
|
|
|
MwStringPrintIntoBuffer(msg, 256, "You pressed: %s", MwListBoxGet(handle, *(int*)call));
|
2025-10-15 10:32:40 +00:00
|
|
|
|
|
|
|
|
msgbox = MwMessageBox(wmain, msg, "wow", MwMB_ICONINFO | MwMB_BUTTONOK);
|
|
|
|
|
MwAddUserHandler(MwMessageBoxGetChild(msgbox, MwMB_BUTTONOK), MwNactivateHandler, destroy, msgbox);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
2026-04-18 19:21:50 +09:00
|
|
|
MwWidget lb;
|
|
|
|
|
int len = sizeof(harvard) / sizeof(harvard[0]) - 1;
|
|
|
|
|
int i;
|
|
|
|
|
int index;
|
|
|
|
|
MwLLPixmap px;
|
2025-11-13 01:30:10 +00:00
|
|
|
|
|
|
|
|
MwLibraryInit();
|
|
|
|
|
|
2025-10-15 10:32:40 +00:00
|
|
|
wmain = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480,
|
2025-10-15 11:42:51 +00:00
|
|
|
MwNtitle, "listbox",
|
2025-10-15 10:32:40 +00:00
|
|
|
NULL);
|
|
|
|
|
lb = MwCreateWidget(MwListBoxClass, "listbox", wmain, 5, 5, 630, 470);
|
|
|
|
|
|
2025-11-21 19:38:27 +00:00
|
|
|
px = MwLoadIcon(lb, MwIconInfo);
|
|
|
|
|
|
2025-11-21 19:43:32 +00:00
|
|
|
MwSetInteger(lb, MwNleftPadding, 20);
|
2025-11-21 19:38:27 +00:00
|
|
|
|
2026-04-18 19:21:50 +09:00
|
|
|
index = MwListBoxInsert(lb, -1, 0, "Harvard sentence");
|
|
|
|
|
MwListBoxInsert(lb, index, -1, "Length");
|
2025-10-22 17:30:57 +00:00
|
|
|
|
2025-10-16 16:47:41 +00:00
|
|
|
for(i = 0; i < len; i++) {
|
2025-10-22 17:30:57 +00:00
|
|
|
char sz[16];
|
2026-03-30 11:19:10 -07:00
|
|
|
MwStringPrintIntoBuffer(sz, 16, "%d", (int)strlen(harvard[i]));
|
2026-04-18 19:21:50 +09:00
|
|
|
index = MwListBoxInsert(lb, -1, 0, harvard[i]);
|
|
|
|
|
MwListBoxInsert(lb, index, -1, sz);
|
|
|
|
|
MwListBoxSetIcon(lb, index, px);
|
2025-10-16 16:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
2025-10-15 10:32:40 +00:00
|
|
|
MwAddUserHandler(lb, MwNactivateHandler, activate, NULL);
|
2025-10-16 16:47:41 +00:00
|
|
|
MwVaApply(lb,
|
|
|
|
|
MwNhasHeading, 1,
|
|
|
|
|
NULL);
|
2025-11-21 19:36:33 +00:00
|
|
|
MwListBoxSetWidth(lb, 0, -128);
|
2025-10-15 08:46:38 +00:00
|
|
|
|
2025-10-15 10:32:40 +00:00
|
|
|
MwLoop(wmain);
|
2025-10-15 08:46:38 +00:00
|
|
|
}
|