From 2141c63628a831d3f53dad7035c94028f8d0d629 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Tue, 21 Jul 2020 20:15:41 -0700 Subject: Implement + deploy fl_strdup() --- examples/table-as-container.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/table-as-container.cxx') diff --git a/examples/table-as-container.cxx b/examples/table-as-container.cxx index 515ad884f..838c55512 100644 --- a/examples/table-as-container.cxx +++ b/examples/table-as-container.cxx @@ -31,6 +31,7 @@ #include #include #include +#include // fl_strdup() void button_cb(Fl_Widget *w, void*); @@ -75,7 +76,7 @@ public: } else { // Create the light buttons sprintf(s, "%d/%d ", r, c); - Fl_Light_Button *butt = new Fl_Light_Button(X,Y,W,H,strdup(s)); + Fl_Light_Button *butt = new Fl_Light_Button(X,Y,W,H,fl_strdup(s)); butt->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); butt->callback(button_cb, (void*)0); butt->value( ((r+c*2) & 4 ) ? 1 : 0); -- cgit v1.2.3 From b4095880125b2f0d1d56c80a2bbf3fb0f6f98cb9 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Tue, 21 Jul 2020 23:57:45 -0700 Subject: Remove unneeded strdup from example, fold tabs --- examples/table-as-container.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/table-as-container.cxx') diff --git a/examples/table-as-container.cxx b/examples/table-as-container.cxx index 838c55512..d5887439d 100644 --- a/examples/table-as-container.cxx +++ b/examples/table-as-container.cxx @@ -31,7 +31,6 @@ #include #include #include -#include // fl_strdup() void button_cb(Fl_Widget *w, void*); @@ -76,7 +75,8 @@ public: } else { // Create the light buttons sprintf(s, "%d/%d ", r, c); - Fl_Light_Button *butt = new Fl_Light_Button(X,Y,W,H,fl_strdup(s)); + Fl_Light_Button *butt = new Fl_Light_Button(X,Y,W,H); + butt->copy_label(s); butt->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); butt->callback(button_cb, (void*)0); butt->value( ((r+c*2) & 4 ) ? 1 : 0); -- cgit v1.2.3