Code Sample |
selbc = fltk:Fl_Round_Button(130,20,18,25,"Breads_Cereals") -- selbc:value(1) selbc:type(fltk.FL_RADIO_BUTTON) selbc:selection_color(fltk.FL_RED) selmd = fltk:Fl_Round_Button(260,20,18,25,"Main Dishes") selmd:type(fltk.FL_RADIO_BUTTON) selmd:selection_color(fltk.FL_RED) selveg = fltk:Fl_Round_Button(130,40,18,25,"Vegetables") selveg:type(fltk.FL_RADIO_BUTTON) selveg:selection_color(fltk.FL_RED) selmisc = fltk:Fl_Round_Button(260,40,18,25,"Miscellaneous") selmisc:type(fltk.FL_RADIO_BUTTON) selmisc:selection_color(fltk.FL_RED) -- setonly():void if selmisc:value() == 1 then foodcat = "Miscellaneous" elseif selmd:value() == 1 then foodcat = "Main Dishes" elseif selveg:value() == 1 then foodcat = "Vegetables" elseif selbc:value() == 1 then foodcat = "Breads_Cereals" end |
Code Sample |
function catfood(self) foodcat=self:label(); print(foodcat); end w=fltk.Fl_Window(300,100,"catfood"); selbc = fltk:Fl_Round_Button(30,20,18,25,"Breads_Cereals") selbc:type(fltk.FL_RADIO_BUTTON); selbc:callback(catfood); -- selmd = fltk:Fl_Round_Button(160,20,18,25,"Main Dishes") selmd:type(fltk.FL_RADIO_BUTTON); selmd:callback(catfood); -- selveg = fltk:Fl_Round_Button(30,40,18,25,"Vegetables") selveg:type(fltk.FL_RADIO_BUTTON); selveg:callback(catfood); -- selmisc = fltk:Fl_Round_Button(160,40,18,25,"Miscellaneous") selmisc:type(fltk.FL_RADIO_BUTTON); selmisc:callback(catfood); w:show(); Fl:run(); |