mikshaw


Group: Members
Posts: 4856
Joined: July 2004 |
 |
Posted: Oct. 26 2007,21:41 |
 |
Added font and color config Automated the table item count Added suport for spaces in labels Removed the Fl_Pack (not needed in a linear array of same-size buttons) Changed the way the window is positioned (w:resize())
Code Sample | ---- CONFIGURATION -- menu: label="command" (use underscores for label spaces) my_menu={ Aterm="aterm -fn proggy", Dillo="dillo", DSL_panel="cpanel.lua", Top="aterm -e top" }
size=11 -- text size bh=16 -- button height bw=100 -- button width Fl:set_font(0,"snap") Fl:background(0,0,0) -- r,g,b (0-255) Fl:foreground(255,255,255) ---- END CONFIGURATION
w=fltk:Fl_Window(0,0,Fl:w(),bh,"MLmenu") w:callback(function() end) butt={} cnt=0 for k,v in pairs(my_menu) do butt[cnt]=fltk:Fl_Button(cnt*bw,0,bw,bh) a,b=string.gsub(k,"_"," ") butt[cnt]:label(a) butt[cnt]:labelsize(size) butt[cnt]:callback(function() os.execute(v.." &") end) butt[cnt]:box(fltk.FL_BORDER_BOX) cnt=cnt+1 end
barw=cnt*bw w:resize(Fl:w()/2-barw/2,0,barw,bh) w:border(0) w:show() Fl:run()
|
-------------- http://www.tldp.org/LDP/intro-linux/html/index.html
|