add a messagebox example

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@262 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-11 08:46:58 +00:00
parent c6b81aff02
commit 359fa8c40d
5 changed files with 33 additions and 1 deletions

20
examples/messagebox.c Normal file
View File

@@ -0,0 +1,20 @@
/* $Id$ */
#include <Mw/Milsko.h>
void ok(MwWidget handle, void* user, void* call) {
MwDestroyWidget(user);
}
void spawn(MwWidget handle, void* user, void* call) {
MwWidget mb = MwMessageBox(user, "new news arrived!", "title", MwMB_ICONNEWS | MwMB_BUTTONOK);
MwAddUserHandler(MwMessageBoxGetChild(mb, MwMB_BUTTONOK), MwNactivateHandler, ok, mb);
}
int main() {
MwWidget msg = MwVaCreateWidget(MwWindowClass, "test", NULL, MwDEFAULT, MwDEFAULT, 300, 100, MwNtitle, "test", NULL);
MwWidget btn = MwVaCreateWidget(MwButtonClass, "button", msg, 8, 8, 300 - 16, 100 - 16, MwNtext, "press me!", NULL);
MwAddUserHandler(btn, MwNactivateHandler, spawn, msg);
MwLoop(msg);
}