> I want do draw a button in FLTK which contains pictures. > > If the button is not pressed, the first image should be shown > in the button. If I press the button, the second picture > should appear. If I release the Button, the first image > should be shown again. > > Does FLTK (1.1.x) support this directly or do I have to do a > workarround?
It t akes a bit of fiddling, but there are several ways you can do this. Rather than try and explain, here's a fluid file that illustrates one possible approach. There are other ways (probably better ways!) too, of course. I'm posting this via Outlook, so there's a fair chance it will be horribly munged when you get it! You'll need to provide two small png's for the demo, one called up.png, the other called dn.png. --------- # data file for the Fltk User Interface Designer (fluid) version 1.0109 header_name {.h} code_name {.cxx} Function {} {open } { Fl_Window {} {open xywh {523 161 452 401} type Double visible } { Fl_Group {} {open xywh {25 25 300 275} box ENGRAVED_FRAME } { Fl_Round_Button b1 { callback {int i = b1->value(); if(i) { b1->image(hidden->image()); b2->image(hidden->deimage()); } else { b1->image(hidden->deimage()); b2->image(hidden->image()); } b1->redraw(); b2->redraw();} image {up.png} deimage {dn.png} xywh {50 40 64 45} type Radio down_box ROUND_DOWN_BOX value 1 when 1 } Fl_Round_Button b2 { callback {int i = b1->value(); if(i) { b1->image(hidden->image()); b2->image(hidden->deimage()); } else { b1->image(hidden->deimage()); b2->image(hidden->image()); } b1->redraw(); b2->redraw();} selected image {dn.png} deimage {dn.png} xywh {55 158 64 53} type Radio down_box ROUND_DOWN_BOX } } Fl_Button hidden { image {up.png} deimage {dn.png} xywh {40 310 64 70} when 0 hide } } } ------ SELEX Sensors and Airborne Systems Limited Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL A company registered in England & Wales. Company no. 02426132 ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk