Code Sample |
ww = 360 wh = 300 button_labels = {"first button","second button","third button","the fourth"} w = Window{ww,wh,"Lua FLTK Templates"} display = Output{140,10,ww-150,25} buttons = Pack{10,10,120,wh-30} function do_butt(self) for i = 1,getn(button_labels) do if self.label == button_labels[i] then display.value = "Button label: "..button_labels[i] break end end end button = {} for i = 1,getn(button_labels) do button[i] = Button{25+i*10,25+i*10,25,25,button_labels[i];callback=do_butt} end buttons:end_layout() w:show() |