News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
group demo
Author Message
widged
Junior Member
**


Posts: 35
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
group demo

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()

06-05-2007 10:21 PM
Visit this user's website Find all posts by this user Quote this message in a reply
widged
Junior Member
**


Posts: 35
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #2
RE: group demo

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)

This post was last modified: 06-05-2007 11:21 PM by widged.

06-05-2007 11:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #3
RE: group demo

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.

06-06-2007 02:25 AM
Find all posts by this user Quote this message in a reply
widged
Junior Member
**


Posts: 35
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #4
RE: group demo

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.

This post was last modified: 06-06-2007 08:10 AM by widged.

06-06-2007 08:02 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: