From 2387173350a6dd5a18fb45eaa161dae54c3b231b Mon Sep 17 00:00:00 2001 From: GenevensiS <66968533+G-e-n-e-v-e-n-s-i-S@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:22:51 +0200 Subject: [PATCH] Add hack to fetch caption if value is empty --- src/render/value/information.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/render/value/information.cpp b/src/render/value/information.cpp index ca4f3e03..f3b01ad5 100644 --- a/src/render/value/information.cpp +++ b/src/render/value/information.cpp @@ -34,7 +34,16 @@ void InfoValueViewer::draw(RotatedDC& dc) { style().padding_top, -style().padding_left - style().padding_right, -style().padding_top - style().padding_bottom - ); - RealSize size = dc.GetTextExtent(value().value); - dc.DrawText(value().value, align_in_rect(style().alignment, size, rect)); + ); + // for some reason, while inside the style tab, this value is empty + // so as a hack for now, if the value is empty, go fetch the caption instead + if (value().value.empty()) { + RealSize size = dc.GetTextExtent(field().caption.get()); + dc.DrawText(field().caption.get(), align_in_rect(style().alignment, size, rect)); + } + // this is what should happen + else { + RealSize size = dc.GetTextExtent(value().value); + dc.DrawText(value().value, align_in_rect(style().alignment, size, rect)); + } }