MacArthur, Ian (SELEX GALILEO, UK) wrote:
>> What is the method to have the text show over the image that 
>> is set as a label? 
> 
> You mean writing the text on top of the image?
> I don't think we support that as a default option.
> 
>> Can this be done or am i just misreading this?
> 
> You need to make a subclass of Fl_Button and then fix up the rendering
> as you want it in the draw() method.
> It's pretty easy to do.
> Also, IIRC, there's working examples of doing this on Greg's site.

        Yes, this example:
        http://seriss.com/people/erco/fltk/#TextOverImage

        There's two examples there; one deriving from Fl_Widget,
        the other deriving from Fl_Button.

        If you're working with a button, example #2 is what you want, eg:
        http://seriss.com/people/erco/fltk/TextOverImageFl_Button

        The trick is to override draw(), and tell the widget
        to draw itself *first* (eg. call Fl_Button::draw() first),
        followed by the image (eg. fl_draw_image()),
        then draw the label text last (eg. with fl_draw()).

        With the Fl_Button example, it's critical that the image draw
        inside the button's border, so it shows the code needed to do
        that correctly (eg. Fl::box_dx() and friends).
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to