-- This will display png and gif images in $HOME/.xtdesktop -- Code by mikshaw (http://damnsmalllinux.org/cgi-bin/forums/ikonboard.cgi) ww=400 --window width wh=350 --window height dir=os.getenv("HOME").."/.xtdesktop/" -- ending slash is vital images = murgaLua.readDirectory(dir) fltk.fl_register_images() function get_image_data(self) for i=0,table.getn(images) do if self:tooltip() == dir..images[i] then -- find the right image display:image(icon[i]:copy(128,128)) --show it bigger! display_label:label(images[i].."\n"..icon[i]:w().."x"..icon[i]:h()) -- show height and width display:redraw() break end end end w=fltk:Fl_Window(ww,wh,"murgaLua Gif/Png Icon Demo") display=fltk:Fl_Box(120,30,256,256) -- big image display_label=fltk:Fl_Box(120,290,256,40) display_label:label("nothing") display:box(fltk.FL_THIN_DOWN_BOX) scroll=fltk:Fl_Scroll(5,5,90,330) pack=fltk:Fl_Pack(5,5,68,300) pack:spacing(2) icon={}; butt={} row=1;col=1 -- since the images table contains more than just images (*.lnk gets in too) -- i'm building the icons from specific items in the table. for i=0,table.getn(images) do if string.find (images[i],".png",-4,plain) or string.find (images[i],".gif",-4,plain) then icon[i]=Fl_Shared_Image.get(dir..images[i]) butt[i]=fltk:Fl_Button(0,0,64,64) butt[i]:align(fltk.FL_ALIGN_CLIP) butt[i]:image(icon[i]) butt[i]:tooltip(dir..images[i]) butt[i]:callback(get_image_data) end end w:show() Fl:run()