Here it is again, to save borrowing around in other threads... function Main() FRAME=wx.wxFrame(wx.NULL,-1,"") FRAME:SetTitle("Symbolic SpinCtrl Array") PANEL=wx.wxPanel(FRAME,-1) IDS=wx.wxID_HIGHEST+1 -- IDS is 'ID Start', first ID of safe range unused by system. NT={"Eins","Zwei","Drei","Vier","Fünf", -- Creates a table of text representations to assist user input. "Sechs","Sieben","Acht","Neun" } NT[0]="Null" SC={} for N=1,4 do local ID=IDS+N SC[N]=wx.wxSpinCtrl(PANEL,ID,"",wx.wxPoint(N*62-60,2), -- Physical placement arithmetic done here to keep it simple. wx.wxSize(60,20),wx.wxSP_ARROW_KEYS+wx.wxTE_PROCESS_ENTER,0,9,N -- Note two 'styles' to enable arrow keys and direct text entry. ) SC[N]:Connect(ID,wx.wxEVT_SCROLL_THUMBTRACK,FeedBack) -- Acts as wxEVT_COMMAND_SPINCTRL_UPDATED once did, ALWAYS signals! SC[N]:Connect(ID,wx.wxEVT_COMMAND_TEXT_ENTER,FeedBack) -- Required, as is wxTE_PROCESS_ENTER, to enable direct number entry. SC[N]:Connect(ID,wx.wxEVT_KILL_FOCUS,NoOp) -- Prevents de-focus replacing text with lowest preset number value. FeedBack(N) end FRAME:SetSize(258,51) FRAME:Centre() FRAME:Show() end
function FeedBack(I) if type(I)=="userdata" then I=I:GetId()-IDS end -- This test allows the function to be passed an event OR an index. SC[I]:SetValue(NT[SC[I]:GetValue()]) -- Fetches value, indexes symbolic text to replace it for user display. end function NoOp() end -- Does nothing! Called to prevent unwanted inbuilt event handling. Main() I added the final call to FeedBack to correctly fill the text fields when it loads, and I thought it looked cool speaking German this time. :) ------------------------------------------------------------------------------ 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