--- a/ui/win32/window.c Sun Oct 12 09:17:37 2025 +0200 +++ b/ui/win32/window.c Sun Oct 12 12:01:03 2025 +0200 @@ -69,6 +69,14 @@ cmdWidget->wclass->eventproc(cmdWidget, hwnd, uMsg, wParam, lParam); } } + case WM_SIZE: { + int width = LOWORD(lParam); + int height = HIWORD(lParam); + if (widget->layout) { + widget->layout(widget->layoutmanager, width, height); + } + break; + } default: return DefWindowProc(hwnd, uMsg, wParam, lParam); } return 0; @@ -112,10 +120,12 @@ UiContainerX *container = ui_box_container_create(obj, hwnd, UI_BOX_VERTICAL, 0, INSETS_ZERO); uic_object_push_container(obj, container); + UiBoxContainer *box = (UiBoxContainer*)container; UiWindow *widget = w32_widget_create(&w32_toplevel_widget_class, hwnd, sizeof(UiWindow)); widget->obj = obj; - widget->container = (UiBoxContainer *)container; + widget->widget.layout = (W32LayoutFunc)ui_grid_layout; + widget->widget.layoutmanager = box->layout; obj->widget = (W32Widget*)widget; obj->ref = 1; @@ -128,15 +138,7 @@ void ui_window_widget_event(W32Widget *widget, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - UiWindow *window = (UiWindow*)widget; - switch (uMsg) { - case WM_SIZE: { - int width = LOWORD(lParam); - int height = HIWORD(lParam); - ui_grid_layout(window->container->layout, width, height); - break; - } - } + //UiWindow *window = (UiWindow*)widget; } void ui_window_widget_show(W32Widget *w, BOOLEAN show) {