diff --git a/CHANGES b/CHANGES index c38c793a0..e75e68131 100644 --- a/CHANGES +++ b/CHANGES @@ -2,7 +2,8 @@ CHANGES IN FLTK 1.1.7 - Documentation fixes (STR #648, STR #692, STR #730, STR #744, STR #745) - - Fixed position of menu titles (STR #794) + - Fixed symbol demo label bug (STR #777) + - Fixed position of menu titles (STR #795) - Added missing Fl_Window::copy_label() method. - Fixed wrong tooltip in fluid (STR #784) - Added zlib path to fluid (STR #783) diff --git a/test/symbols.cxx b/test/symbols.cxx index 3d43ea4f9..08d21dc59 100644 --- a/test/symbols.cxx +++ b/test/symbols.cxx @@ -49,24 +49,21 @@ void slider_cb(Fl_Widget *w, void *) { int sze = (int)size->value(); for (int i = window->children(); i--; ) { // all window children Fl_Widget *wc = window->child(i); - const char *l = wc->label(); - if ( *l == '@' ) { // all children with '@' - if ( *(++l) == '@' ) { // ascii legend? - l++; - while (isdigit(*l)||(*l=='+'&&l[1])||*l=='-') { l++; } + const char *l = (const char *)(wc->user_data()); + if ( l && *l == '@' ) { // all children with '@' + l ++; + if ( wc->box() == FL_NO_BOX ) { // ascii legend? if (val&&sze) sprintf(buf, "@@%+d%d%s", sze, val, l); else if (val) sprintf(buf, "@@%d%s", val, l); else if (sze) sprintf(buf, "@@%+d%s", sze, l); else sprintf(buf, "@@%s", l); } else { // box with symbol - while (isdigit(*l)||(*l=='+'&&l[1])||*l=='-') { l++; } if (val&&sze) sprintf(buf, "@%+d%d%s", sze, val, l); else if (val) sprintf(buf, "@%d%s", val, l); else if (sze) sprintf(buf, "@%+d%s", sze, l); else sprintf(buf, "@%s", l); } - free((void*)(wc->label())); - wc->label(strdup(buf)); + wc->copy_label(buf); } } window->redraw(); @@ -80,11 +77,17 @@ void bt(const char *name) { x = x*W+10; y = y*H+10; sprintf(buf, "@%s", name); - Fl_Box *a = new Fl_Box(FL_NO_BOX,x,y,W-20,H-20,strdup(buf)); + Fl_Box *a = new Fl_Box(x,y,W-20,H-20); + a->box(FL_NO_BOX); + a->copy_label(buf); a->align(FL_ALIGN_BOTTOM); a->labelsize(11); - Fl_Box *b = new Fl_Box(FL_UP_BOX,x,y,W-20,H-20,strdup(name)); + a->user_data((void *)name); + Fl_Box *b = new Fl_Box(x,y,W-20,H-20); + b->box(FL_UP_BOX); + b->copy_label(name); b->labelcolor(FL_DARK3); + b->user_data((void *)name); } int main(int argc, char ** argv) {