Thankyou. It ran, but it was something in your code that led to the answer, and this time it really IS the answer:
SC:Connect(-1,wx.wxEVT_SCROLL_THUMBTRACK,DoStuff) -- Where SC is a SpinCtrl. That's it! Do this instead of SPINCTRL_UPDATED, and it works. What's even more amazing is that this removes the need for the KILL_FOCUS correction too, it totally restores SpinCtrl to the behaviour it used to have with wxEVT_COMMAND_SPINCTRL_UPDATED in wxLua v2.54, it appears to be an exact substitute. It was your use of EVT_SCROLL_LINEUP (and DOWN) that led me there. First, I tried my own SpinButton code, and that failed because SpinButton has its own breakage! Fails to use SP_ARROW_KEYS. Never mind what the docs say, it doesn't work, nor does the mouswheel which works by default with that style (in SpinCtrl anyway). But I also read that some (not all) of the SpinButton events are also used (on some platforms) by SpinCtrl. I hunted online for any worked example of event handling in SpinButton beyond yours, because there is none in the sample scripts! I found my answer on some list of events, but I had no idea if it would work till I tried it. At times I despair of documentation! For example wx.chm states that EVT_SPINCTRL is handled. Well it isn't, if you write that you just get an error, you have to write wxEVT_COMMAND_SPINCTRL_UPDATED if you want that to work! This isn't an example of transparent clarity! Worse, wx.wxEVT_SCROLL_THUMBTRACK isn't named at all in this context, and given what its name IS, it's hardly surprising that most users would have no clue that it will work. Which means we have NO idea if it will still work later if (hopefully when) someone cleans this up! Or if someone breaks the inbuilt scrollwheel link with SpinCtrl, as seems to be the case with SpinButton already, if it ever had one. I love wxLua, I really do, it's let me do more than any other system so far, but at times like these I wonder if it isn't a cloud of nonsense between me and the API that I'd do better to blow aside completely. The naming, linking, and conventions of event handling seem especially loose and uncoordinated. This is really a case where ONLY a solid body of worked examples will do, documentation is NEVER enough. Only established practise is going to lock this down. Whether anyone cares enough to trust any of my code as a partial basis for worked examples is something I doubt, but I will hand it over if you want it. I'm willing to spend some time reducing several things I've done to minimal demonstration scripts, if the effort is not wasted. I'm not the most knowledgebale, but I am persistent enough to come up with answers, and I think wxLua maybe needs all the help it can get, there aren't a lot of people around... Ok, I ranted again, but I think I earned the right to a little excess, given that this mail does include the kind of answer that we need, very small, very effective, as it gives a signal every time an attempt is made with SpinCtrl, instead of taking from us the right to decide what events matter. Andre Arpin <ar...@kingston.net> wrote: (30/12/2010 23:35) >I hope this version will run > >“strict” is a popular module used to prevent leaky variables, most useful. > >This code emulates the spin control and should make it easier to support your >variations. I hope it works. I just shorten the lines. Line are not properly >broken and probably should be adjusted for clarity. > >local baseID = wx.wxID_HIGHEST + 1 > >textControls = {} >frame = wx.wxFrame(wx.NULL, >wx.wxID_ANY,'Test spin control') >frame:Show(true) > >function spin(event) > local localSpin = event:GetEventObject(): > DynamicCast("wxSpinButton") > print(localSpin.Value) > print(event.Id) > textControls[event.Id - baseID + 1][1].Value = > tostring(localSpin.Value)..'!' >end > >function text(event) > print(event.KeyCode) > event:Skip() > local localText = event:GetEventObject(): > DynamicCast("wxTextCtrl") > local v = tonumber(localText.Value) > print(v) > if v then > textControls[event.Id - baseID + 1][2].Value = v > end >end > >for ID= baseID, baseID + 10 do > local top = 30*#textControls > local textControl = > wx.wxTextCtrl(frame, ID, 'test', wx.wxPoint(20,top)) > local spinControl = > wx.wxSpinButton(frame, ID, wx.wxPoint(0,top)) > table.insert(textControls, {textControl, spinControl}) > spinControl:SetRange(10,20) > spinControl:Connect(wx.wxEVT_SCROLL_LINEUP, spin) > spinControl:Connect(wx.wxEVT_SCROLL_LINEDOWN, spin) > textControl:Connect(wx.wxEVT_KEY_DOWN, text) > >end > >wx.wxGetApp():MainLoop() > >Good luck. > >Andre > > >------------------------------------------------------------------------------ >Learn how Oracle Real Application Clusters (RAC) One Node allows customers >to consolidate database storage, standardize their database environment, and, >should the need arise, upgrade to a full multi-node Oracle RAC database >without downtime or disruption >http://p.sf.net/sfu/oracle-sfdevnl >_______________________________________________ >wxlua-users mailing list >wxlua-users@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/wxlua-users ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users