From: Lostgallifreyan <z....@bt...> - 2010-12-30 15:54:08
|
Andre Arpin <ar...@ki...> wrote: (30/12/2010 14:36) >> for I=7,151 do >> CT[I]:Connect(wx.wxEVT_KILL_FOCUS, >> function(EV) FeedBack(EV:GetId()) end >> ) >> end >> > >> What about: >local function KILL_FOCUS(EV) FeedBack(EV:GetId() > >for I=7,151 do > CT[I]:Connect(wx.wxEVT_KILL_FOCUS, KILL_FOCUS) >end > > >151 pointers to one function > >better > >function FeedBack(event) > local Id = event.Id > ..... old code for feed back >end > >for I=7,151 do > CT[I]:Connect(wx.wxEVT_KILL_FOCUS, FeedBack) >end > This is a bit like focussing on a leaky tap in a burning building, given the other more serious problems with Spinctrl. I know attention to details matters, but not at the expense of the whole picture. I think this is why Spinctrl got broken in the first place! Too much specialisation... Not good for science in general. Certainly not good for code. That said, I'll bite. :) It's still worth discussing. I see your point, but I have other calls to FeedBack() that have an ID, are not event driven. If I could test for variable type at the start of FeedBack() this might work, possibly? I don't know if the event passed to a variable HAS a type. in the Lua sense of the word... |