On 10/16/12 13:23, Ian MacArthur wrote:
> 
> On 16 Oct 2012, at 20:36, Doug Parks wrote:
> 
>> I decided to make a custom button class so that I could reduce the amount of 
>> code in my project.  I was able to create the button but when I click on the 
>> button, the callback isn't being called.  Before I made the custom button 
>> class the button worked fine.  Below is an excerpt from my code.
>>
>> class newButton : public Fl_Button
>> {
>>   Fl_Button *myButton;
>>   public:
>>   newButton(int x, int y, int w, int h, const char * l = 0):Fl_Button(x, y, 
>> w, h, l)
>>   {
>>     myButton = new Fl_Button(x, y, w, h, l);
>> [..]

> Um, I may be missing something important, but why have you created
> a new button inside your derived button class?
> 
> In general, that is not needed... 

        Right; not needed, and probably just bad.

        Deriving a class from Fl_Button automatically creates the button,
        so you don't want to create /another/ one in the ctor.. that just
        makes a new button that exactly overlaps the other.

        Overlapping widgets like buttons is bad.
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to