Murga-Projects Forums

Full Version: Changing background image of main window?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi folks,

Is there a way to add a background image to the main window?  Hhere's what I'm trying:

Code:
do local object = fltk:Fl_Window(100, 100, 800, 600, "Test Window")
    window = object
    local image_master_back = fltk:Fl_JPEG_Image("master_back.jpg")
    window:image(image_master_back)
...

However, it doesn't do what I expect.  

Any ideas?
TIA
Mike

It seems as though Fl_Window does not support the image method. You can fake it by adding my_background=fltk:Fl_Box(0,0,window_width,window_height) immediately after defining the window (so all other widgets will show over it) and applying the image to the box.

EDIT:
That "do local object=blah blah; window=object" thing is really annoying. Fluid seems to be a serious waste of bytes.

Code:
window=fltk:Fl_Window(100,100,800,600,"Test Window")
background=fltk:Fl_Box(0,0,800,600)
image_master_back=fltk:Fl_JPEG_Image("master_back.jpg")
background:image(image_master_back)

Perfect, that did the trick.
Reference URL's