From 7d34abc3e8fd3c5361936c5fecd7862291acc790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 2 Feb 2006 18:15:52 +0000 Subject: [PATCH] No longer tries to create a "" label. An empty label is now NULL. Probably among other, this fixes the BSlider appearance without a label. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16207 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Control.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/Control.cpp b/src/kits/interface/Control.cpp index 675ebfc5d5..d0b76580dd 100644 --- a/src/kits/interface/Control.cpp +++ b/src/kits/interface/Control.cpp @@ -270,13 +270,18 @@ BControl::DetachedFromWindow() void -BControl::SetLabel(const char *string) +BControl::SetLabel(const char *label) { - if (fLabel && string && strcmp(fLabel, string) == 0) + if (label != NULL && !label[0]) + label = NULL; + + // Has the label been changed? + if ((fLabel && label && !strcmp(fLabel, label)) + || ((fLabel == NULL || !fLabel[0]) && label == NULL)) return; free(fLabel); - fLabel = strdup(string ? string : B_EMPTY_STRING); + fLabel = label ? strdup(label) : NULL; Invalidate(); }