[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: flconvert for lua-fltk, v0.1
- From: "Jay Carlson" <nop@...>
- Date: Tue, 10 Jul 2001 16:52:36 -0400
"Kenneth Rochel de Camargo Jr." <kenneth@uerj.br> writes:
> On 9 Jul 2001, at 23:50, Jay Carlson wrote:
> > I've made a slightly modified version of "flconvert" from the pyfltk
> > package.
> > (...)
> > Figured somebody might be interested...
> >
> I certainly am. Where's the fltk binding?
http://www.place.org/~nop/lua-fltk-0.1.tar.gz ; read the README for
disclaimers.
w = Fl_Window:new(300,180,"Hi there!")
box = Fl_Button:new(20,40,260,100, "hello, world!")
box:labelfont(FL_BOLD + FL_ITALIC)
box:labelsize(36)
box:labeltype(FL_SHADOW_LABEL)
w:end_layout()
w:show()
function fltk_dispatch(n) if n.callback then n:callback() end end
function box:callback() fl_alert("hello, world") end
fl_cb(box) -- register box for callbacks
The two errors I've found so far are:
1) widget:label(s) doesn't stash a copy of s anywhere, so if s ever gets
garbage collected, the label will break. I believe constant strings in
functions won't be collected, so this is hidden in common use.
2) Fl_Box:new(boxtype, x,y,w,h, [label]) was the wrong constructor to pick;
it was ambiguous with Fl_Box:new(x,y,w,h, label) as far as toLua was
concerned. flconvert prefers the second.
I've been working on a more Lua-flavored API on top of the toLua fltk API;
I'll post when I get it functional.
Jay