diff --git a/example.c b/example.c index 2c8967c33..49643b3a8 100644 --- a/example.c +++ b/example.c @@ -7,17 +7,19 @@ void handler(MwWidget handle, void* user_data, void* call_data){ } int main(){ - int i; - MwWidget window = MwVaCreateWidget(MwWindowClass, "main", NULL, 0, 0, 400, 400, + int y, x; + MwWidget window = MwVaCreateWidget(MwWindowClass, "main", NULL, 0, 0, 400, 260, MwNtitle, "hello world", NULL); - for(i = 0; i < 6; i++){ - MwWidget button = MwVaCreateWidget(MwButtonClass, "button", window, 5, 5 + 55 * i, 390, 50, - MwNtext, "lorem ipsum", - NULL); + for(y = 0; y < 5; y++){ + for(x = 0; x < 2; x++){ + MwWidget button = MwVaCreateWidget(MwButtonClass, "button", window, 5 + 195 * x, 5 + 50 * y, 195, 50, + MwNtext, "lorem ipsum", + NULL); - MwAddUserHandler(button, MwNactivateHandler, handler, NULL); + MwAddUserHandler(button, MwNactivateHandler, handler, NULL); + } } MwLoop(window); diff --git a/src/gdi.c b/src/gdi.c index d991d3273..f49d6a358 100644 --- a/src/gdi.c +++ b/src/gdi.c @@ -17,9 +17,11 @@ static LRESULT CALLBACK wndproc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { MwLLDispatch(u->ll, draw); EndPaint(hWnd, &ps); } else if(msg == WM_LBUTTONDOWN) { + SetCapture(hWnd); MwLLDispatch(u->ll, down); InvalidateRect(hWnd, NULL, FALSE); } else if(msg == WM_LBUTTONUP) { + SetCapture(NULL); MwLLDispatch(u->ll, up); InvalidateRect(hWnd, NULL, FALSE); } else if(msg == WM_ERASEBKGND) {