mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-03 16:10:50 +00:00
oops
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@765 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
41
examples/basic/treeview.c
Normal file
41
examples/basic/treeview.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include <Mw/Milsko.h>
|
||||
|
||||
MwWidget wmain;
|
||||
|
||||
void destroy(MwWidget handle, void* user, void* call) {
|
||||
(void)handle;
|
||||
(void)call;
|
||||
MwMessageBoxDestroy(user);
|
||||
}
|
||||
|
||||
void activate(MwWidget handle, void* user, void* call) {
|
||||
char msg[256];
|
||||
MwWidget msgbox;
|
||||
|
||||
(void)user;
|
||||
|
||||
sprintf(msg, "You pressed: %s", MwTreeViewGet(handle, call));
|
||||
|
||||
msgbox = MwMessageBox(wmain, msg, "wow", MwMB_ICONINFO | MwMB_BUTTONOK);
|
||||
MwAddUserHandler(MwMessageBoxGetChild(msgbox, MwMB_BUTTONOK), MwNactivateHandler, destroy, msgbox);
|
||||
}
|
||||
|
||||
int main(){
|
||||
MwWidget tv;
|
||||
int i;
|
||||
void* p = NULL, *r;
|
||||
|
||||
MwLibraryInit();
|
||||
|
||||
wmain = MwCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 5 + 640 + 5, 5 + 480 + 5);
|
||||
tv = MwCreateWidget(MwTreeViewClass, "tree", wmain, 5, 5, 640, 480);
|
||||
|
||||
MwAddUserHandler(tv, MwNactivateHandler, activate, NULL);
|
||||
|
||||
for(i = 0; i < 10; i++){
|
||||
p = MwTreeViewAdd(tv, p, NULL, "Hello");
|
||||
if(i == 5) r = p;
|
||||
}
|
||||
|
||||
MwLoop(wmain);
|
||||
}
|
||||
Reference in New Issue
Block a user