Hi!
I solved my problem... with your help! Thanks!
I did the following:
1. Defined my botton when(FL_WHEN_CHANGED)
2. Did what was suggested by Scott A Thisse:
if (b->value())
b->image(rgb);
else
b->image(dergb);
Thanks!
> > I don't think that's quite the same thing, though - those images control
> > the button appearance in the active/inactive states, whereas I *think*
> > what the OP wants is button images for the not-pressed/pressed states,
> > which fltk doesn't support directly. (And which is not *quite* what the
> > demo I posted does, either...)
>
> Yep, I completely misunderstood the OP's question; I wish I'd seen your
> response first.
>
> The image.cxx example can be made to provide the functionality requested
> by the OP using the following code (which is very similar to yours) in
> the callback function.
> ===== ===== =====
> if (b->value())
> b->image(rgb);
> else
> b->image(dergb);
> ===== ===== =====
>
> To make this work, button b was changed to a Fl_Toggle_Button and to use
> the callback function. Also, rgb and dergb were made global so that the
> callback could use them.
>
> A diff of the changes:
> ===== ===== =====
> 43a44,47
> > Fl_RGB_Image *rgb;
> > Fl_Image *dergb;
> >
> >
> 71a76,81
> >
> > if (b->value())
> > b->image(rgb);
> > else
> > b->image(dergb);
> >
> 80a91
> >
> 126,129c137,138
> < Fl_Button b(140,160,120,120,"Image w/Alpha"); ::b = &b;
> <
> < Fl_RGB_Image *rgb;
> < Fl_Image *dergb;
> ---
> > Fl_Toggle_Button b(140,160,120,120,"Image w/Alpha"); ::b = &b;
> > b.callback(button_cb);
> ===== ===== =====
>
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk