mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-10 03:13:28 +00:00
add messagebox
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@338 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -3,13 +3,30 @@
|
|||||||
|
|
||||||
#include "../resource/harvard.c"
|
#include "../resource/harvard.c"
|
||||||
|
|
||||||
|
MwWidget wmain;
|
||||||
|
|
||||||
|
void destroy(MwWidget handle, void* user, void* call) {
|
||||||
|
MwDestroyWidget(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
void activate(MwWidget handle, void* user, void* call) {
|
||||||
|
char msg[256];
|
||||||
|
MwWidget msgbox;
|
||||||
|
sprintf(msg, "You pressed: %s", MwListBoxGet(handle, *(int*)call));
|
||||||
|
|
||||||
|
msgbox = MwMessageBox(wmain, msg, "wow", MwMB_ICONINFO | MwMB_BUTTONOK);
|
||||||
|
MwAddUserHandler(MwMessageBoxGetChild(msgbox, MwMB_BUTTONOK), MwNactivateHandler, destroy, msgbox);
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
MwWidget w = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480,
|
MwWidget lb;
|
||||||
|
wmain = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 640, 480,
|
||||||
MwNtitle, "test",
|
MwNtitle, "test",
|
||||||
NULL);
|
NULL);
|
||||||
MwWidget lb = MwCreateWidget(MwListBoxClass, "listbox", w, 5, 5, 630, 470);
|
lb = MwCreateWidget(MwListBoxClass, "listbox", wmain, 5, 5, 630, 470);
|
||||||
|
|
||||||
|
MwAddUserHandler(lb, MwNactivateHandler, activate, NULL);
|
||||||
MwListBoxInsertMultiple(lb, -1, (char**)harvard, sizeof(harvard) / sizeof(harvard[0]) - 1);
|
MwListBoxInsertMultiple(lb, -1, (char**)harvard, sizeof(harvard) / sizeof(harvard[0]) - 1);
|
||||||
|
|
||||||
MwLoop(w);
|
MwLoop(wmain);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user