Re: [fltk.general] Background Image for Button

208 views
Skip to first unread message

Albrecht Schlosser

unread,
Feb 3, 2015, 8:34:43 AM2/3/15
to fltkg...@googlegroups.com
On 03.02.2015 14:13 narendra vuppuluri wrote:
> I need to change a normal button to a button with an image in it.
> Is it possible to add a background image to a button to achieve this ?
> If so how to do it?

There are two methods available: Fl_Widget::image() for the image of an
active widget and deimage() for an inactive widget. There are also
several alignment options Fl_Widget::align() to position an image and
additional label text.

http://www.fltk.org/doc-1.3/classFl__Widget.html


Greg Ercolano

unread,
Feb 3, 2015, 9:11:09 AM2/3/15
to fltkg...@googlegroups.com
On 02/03/15 05:34, Albrecht Schlosser wrote:
> [..] There are also several alignment options Fl_Widget::align()
> to position an image and additional label text.
> http://www.fltk.org/doc-1.3/classFl__Widget.html

And if you want the button's text label() to appear
inside the image (comped 'over' it), you can add:

FL_ALIGN_IMAGE_BACKDROP

..to the align() flags. See: http://seriss.com/people/erco/fltk/#TextOverImage

This is not to be confused with the other align() flag
that might seem to mean the same thing:

FL_ALIGN_TEXT_OVER_IMAGE

..which means 'over' the image in the sense of
"above and outside" the image, i.e. along its top edge.

narendra

unread,
Feb 5, 2015, 9:25:54 AM2/5/15
to fltkg...@googlegroups.com
Thanks.That worked.
Reply all
Reply to author
Forward
0 new messages