rafa wrote:
> I have tested align method of Fl_Button, but I can not get to solve my 
> problem.
> Image inside Fl_Button is center horizontally, but not vertically.

        Hmm, it should be centered.

        The following works for me in 1.1.9 and 1.3.x; when you compile
        the following, doesn't the image show up centered?

        In this example, I purposefully made the button much larger
        than the image so centering is clear.

        Compare this code to yours to see what's wrong.
        I find I can even comment out the align() and the image remains
        centered in all directions, as apparently that's the default.

        Maybe your original image isn't symmetrically cropped?

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Shared_Image.H> // fl_register_images
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Button.H>
static const char *x_xpm[] = {                       // this is a .xpm file
"14 14 2 1",
"       c None",
"x      c #585858",
"              ",
"    xxxxx     ",
"  xxxxxxxxx   ",
"  xxxxxxxxx   ",
" xx  xxx  xx  ",
" xxx  x  xxx  ",
" xxxx   xxxx  ",
" xxxx   xxxx  ",
" xxx  x  xxx  ",
" xx  xxx  xx  ",
"  xxxxxxxxx   ",
"  xxxxxxxxx   ",
"    xxxxx     ",
"              "};

int main() {
    fl_register_images();          // initialize image lib
    Fl_Window win(720,486);        // make a window
    Fl_Button but(10,10,100,100);  // make a button
    Fl_Pixmap x(x_xpm);            // assign xpm to a pixmap
    but.image(x);                  // attach pixmap to button as image
    but.align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
    win.show();
    return(Fl::run());
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to