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 
FLU - FLTK Utility Widgets
Author Message
iGame3D
Moderator
***


Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #1
FLU - FLTK Utility Widgets

FLU - FLTK UTILITY WIDGETS
I found the project on my hard drive and remembered that it looked handy.
Cool features!

Would adding this bloat murgaLua too much?  

If I didn't mention it now it might be another many
months before I find it on my hard drive.

This post was last modified: 02-11-2008 07:13 AM by iGame3D.

02-08-2008 05:48 PM
Visit this user's website Find all posts by this user Quote this message in a reply
JohnMurga
Administrator
*******


Posts: 381
Group: Administrators
Joined: Apr 2007
Status: Offline
Reputation: 2
Post: #2
RE: FLU - FLTK UTILITY WIDGETS

iGame3D Wrote:
FLU - FLTK UTILITY WIDGETS
I found the project on my hard drive and remembered that it looked handy.
Cool features!

Would adding this bloat murgaLua too much?

If I didn't mention it now it might be another many
months before I find it on my hard drive.

Hi,

I did play around with this a while ago, it is very cool, but it presents two problems ...

It is VERY callback based, and would add a lot of complexity.

AND it adds more bloat to murgaLua than I'd like to have.

I prefer to have a solid FLTK integration, and small, clearly defined extensions where FLTK falls short.

Cheers
JohnM

This post was last modified: 02-08-2008 07:29 PM by JohnMurga.

02-08-2008 07:28 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: FLU - FLTK UTILITY WIDGETS

I think a few of these could be done, with some effort, in murgaLua. They mostly look like combinations of existing widgets, which could be manipulated with Lua.

02-09-2008 01:24 AM
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: #4
RE: FLU - FLTK UTILITY WIDGETS

This is a simple (but probably not efficient) way to create a rollover button using a timer. I thought it might have been possible to use when() instead of a loop, but I guess not.

Code:
w=fltk:Fl_Window(200,100,"Rollover Test")
b=fltk:Fl_Button(10,10,180,30,"rollover")

bg=b:color()
fg=b:labelcolor()
function loop()
if Fl:event_inside(b)==1 then
b:color(fg); b:labelcolor(bg)
else
b:color(bg); b:labelcolor(fg)
end
b:redraw()
timer:doWait(0.05)
end

timer=murgaLua.createFltkTimer()
timer:callback(loop)
timer:do_callback()

w:show()
Fl:run()

I'm not even going to attempt to do the file chooser, although I'm betting it's possible without adding anything to murgaLua.

02-09-2008 02:43 AM
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: #5
RE: FLU - FLTK UTILITY WIDGETS

Flu_Toggle_Group:

Code:
w=fltk:Fl_Window(400,300,"Flu_Toggle_group")
g=fltk:Fl_Group(10,30,380,240)
g:box(fltk.FL_EMBOSSED_FRAME)
fltk:Fl_Button(40,80,180,30,"button")
fltk:Fl_Button(40,115,180,30,"button")
fltk:Fl_Button(40,150,180,30,"button")
fltk:Fl_End()
t=fltk:Fl_Check_Button(20,15,120,30,"Toggle_Group")
t:box(fltk.FL_FLAT_BOX)
t:callback(function()
  if g:active()==1 then g:deactivate() else g:activate() end
end
)
t:value(1)
w:show()
Fl:run()

This post was last modified: 02-09-2008 12:27 PM by mikshaw.

02-09-2008 03:26 AM
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: #6
RE: FLU - FLTK UTILITY WIDGETS

Flu_Choice_Group:

Code:
page={}
w=fltk:Fl_Window(400,300,"Flu_Choice_Group")
g=fltk:Fl_Wizard(10,30,380,240)
g:box(fltk.FL_EMBOSSED_FRAME)
page[1]=fltk:Fl_Group(10,30,380,240)
fltk:Fl_Button(40,80,180,30,"button")
fltk:Fl_End() --1
page[2]=fltk:Fl_Group(10,30,380,240)
fltk:Fl_Button(40,80,180,30,"button")
fltk:Fl_Button(40,115,180,30,"button")
fltk:Fl_End() --2
page[3]=fltk:Fl_Group(10,30,380,240)
fltk:Fl_Button(40,80,180,30,"button")
fltk:Fl_Button(40,115,180,30,"button")
fltk:Fl_Button(40,150,180,30,"button")
fltk:Fl_End() --3
fltk:Fl_End() --main
c=fltk:Fl_Choice(20,15,180,30)
c:callback(function() g:value(page[c:value()]) end)

c:add("Choice_Group")
c:add("first tab")
c:add("second tab")
c:add("third tab")
c:value(0)
w:show()
Fl:run()

with a function:

Code:
function flu_choice_group(x,y,w,h,tabs,table,label)
local g=fltk:Fl_Wizard(x,y,w,h,label)
g:box(fltk.FL_EMBOSSED_FRAME)
fltk:Fl_End()
c=fltk:Fl_Choice(20,15,180,30)
c:callback(function() g:value(table[c:value()]) end)
if not tabs then local tabs=0 end
for i=0,tabs do
  table[i]=fltk:Fl_Group(x,y,w,h)
  fltk:Fl_End()
  g:add(table[i])
  c:add("tab "..i)
end
c:value(0)
end

page={}
w=fltk:Fl_Window(400,300,"Choice_Group Test")

g=flu_choice_group(10,30,380,240,3,page)

a1=fltk:Fl_Button(40,80,180,30,"button")
page[0]:add(a1)
b1=fltk:Fl_Button(40,80,180,30,"button")
b2=fltk:Fl_Button(40,115,180,30,"button")
page[1]:add(b1)
page[1]:add(b2)
c1=fltk:Fl_Button(40,80,180,30,"button")
c2=fltk:Fl_Button(40,115,180,30,"button")
c3=fltk:Fl_Button(40,150,180,30,"button")
page[2]:add(c1)
page[2]:add(c2)
page[2]:add(c3)

w:show()
Fl:run()

This post was last modified: 02-09-2008 12:30 PM by mikshaw.

02-09-2008 07:46 AM
Find all posts by this user Quote this message in a reply
iGame3D
Moderator
***


Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #7
RE: FLU - FLTK UTILITY WIDGETS

Heh, and you say you are not a programmer.
Keep going :-)

02-11-2008 07:13 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: