From d5c01b3dd1cd98cb945e22b18604f2eb915fdc67 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Tue, 25 Jul 2017 06:41:32 +0800 Subject: [PATCH] adjust inputbox element width for good looking --- source/gui/msgbox.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/gui/msgbox.cpp b/source/gui/msgbox.cpp index a0500dc2..f978bf1a 100644 --- a/source/gui/msgbox.cpp +++ b/source/gui/msgbox.cpp @@ -1288,6 +1288,8 @@ namespace nana std::vector each_pixels; unsigned label_px = 0, fixed_px = 0; paint::graphics graph({ 5, 5 }); + + bool has_0_fixed_px = false; for (auto p : contents) { auto px = label::measure(graph, p->label(), 150, true, align::right, align_v::center); @@ -1295,13 +1297,15 @@ namespace nana label_px = px.width; px.width = p->fixed_pixels(); + has_0_fixed_px |= (px.width == 0); if (px.width > fixed_px) fixed_px = px.width; each_pixels.push_back(px.height); } - if (fixed_px < 100) + //Adjust the fixed_px for good looking + if (has_0_fixed_px && (fixed_px < 100)) fixed_px = 100; inputbox_window input_wd(owner_, images_, valid_areas_, description_, title_, contents.size(), label_px + 10 + fixed_px, each_pixels);