Murga-Projects Forums
group demo - 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: group demo (/showthread.php?tid=37)


group demo - widged - 06-05-2007 10:21 PM

Peeking at some of mikshaw scripts, it seems that the syntax to define groups is something of the like:

Code:
ww=180 --window dims
wh=200
gw=ww-20 -- group dims
gh=wh-50

w=fltk:Fl_Window(ww,wh,"murgaLua Group Demo")
w:color(55)

group = fltk:Fl_Group(10,10,gw,gh)
group:box(fltk.FL_BORDER_BOX)
group:color(79)

  frame1=fltk:Fl_Box(20,20,50,50);
  frame1:box(fltk.FL_BORDER_BOX)
  frame1:color(82)

  frame2=fltk:Fl_Box(100,100,50,50);
  frame2:box(fltk.FL_BORDER_BOX)
  frame2:color(92)

fltk:Fl_End()

but_show = fltk:Fl_Button(10,wh-30,50,22,"show");
but_show:callback(function()
  group:show()
end)

but_hide = fltk:Fl_Button(75,wh-30,50,22,"hide");
but_hide:callback(function()
  group:hide()
end)

w:show()
Fl:run()




RE: group demo - widged - 06-05-2007 11:20 PM

Better UI

Replace this:

Code:
but_show = fltk:Fl_Button(10,wh-30,50,22,"show");
but_show:callback(function()
  group:show()
end)

but_hide = fltk:Fl_Button(75,wh-30,50,22,"hide");
but_hide:callback(function()
  group:hide()
end)


With:

Code:
but = fltk:Fl_Light_Button(10,wh-30,80,22,"visible");
but:value(1)
but:callback(function(self)
  if (self:value() == 1) then
    group:show()
  else
    group:hide()
  end
end)




RE: group demo - mikshaw - 06-06-2007 02:25 AM

Please note that my scripts are part of the learning process for myself as well. Anything I put in a script, whether or not it has been released as "official learning material", should be assumed to be only one method of accomplishing a task, and not necessarily even close to being the best method. I typically poke at things until I find something that seems to accomplish what I want without any obvious flaws. =o)

That said, thank you for another bit of enlightenment.


RE: group demo - widged - 06-06-2007 08:02 AM

Same status for the stuff I put here. I am a complete rookie Smile

For ease of use, all demo code I provided in this forum has been added to the murgalua gallery in the form of short demos.