> Thankyou. That did so many odd things that I don't know what to do with it. :) Nice to see a fully worked example > though, snippets don't always work, full examples do, I wish they happened more often. :) > > While I can do the area detection (already had to in some other project), this is not really the answer. As you > see, it takes a lot of ectra code. It doesn't stop there either, I have to handle arrow keys, mouse scrolls, > maybe even more stuff, just to get a Spinctrl to work as it used to with NONE of this extra code! >
try this you have full control if yo do not like using the ID for an offset to an index you could use Set/GetClientData on the control textControl.ClientData = #textControls spinControl.ClientData = #textControls require 'strict' 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() maybe wxEVT_COMMAND_SPINCTRL_UPDATED might work I did not try it. You probably want the text to always be numeric etc leaving this to the reader, always mean to me the writer has no clue how to doit :) 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