widget disabling and autosize with minimum
[instimg] / src / main.c
index 68b4c98..b49c9e3 100644 (file)
@@ -31,7 +31,7 @@ int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprevinst, char *cmdline, int show
        lb_instto = wgt_label(win, "Install to device:", 10, 10);
 
        x = wgt_xpos_after(lb_instto, WGT_AUTO);
-       cb_devs = wgt_combo(win, items, num_rawdev, 0, x, 10, WGT_AUTO, WGT_AUTO,
+       cb_devs = wgt_combo(win, items, num_rawdev, 0, x, 10, WGT_AUTOMIN(30), WGT_AUTO,
                        onmodify);
 
        y = wgt_ypos_after(cb_devs, 16);
@@ -44,6 +44,11 @@ int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprevinst, char *cmdline, int show
        x = wgt_xpos_after(bn_inst, WGT_AUTO);
        bn_cancel = wgt_button(win, "Cancel", x, y, WGT_AUTO, WGT_AUTO, onclick);
 
+       if(!num_rawdev) {
+               wgt_disable_widget(cb_devs);
+               wgt_disable_widget(bn_inst);
+       }
+
        while(GetMessage(&msg, 0, 0, 0)) {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
@@ -65,4 +70,4 @@ static void onmodify(struct wgt_widget *w)
                const char *selstr = wgt_get_combo_item(w, sel);
                MessageBox(0, selstr, "selected item", MB_OK);
        }
-}
\ No newline at end of file
+}