Murga-Projects Forums
Changing background image of main window? - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: Changing background image of main window? (/showthread.php?tid=122)


Changing background image of main window? - mikecrowe - 07-21-2007 01:09 AM

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


RE: Changing background image of main window? - mikshaw - 07-21-2007 02:24 AM

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)




RE: Changing background image of main window? - mikecrowe - 07-21-2007 05:50 AM

Perfect, that did the trick.