Lostgallifreyan <z.c...@btinternet.com> wrote:
(31/12/2010 16:23)

>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.
'
'
'
>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 was wrong about that KILL_FOCUS point, but I have worked out an example 
of an array of symbolic SpinCtrls that might be a useful inclusion to the 
example scripts:



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={"One","Two","Three","Four","Five",                                        
-- Creates a table of text representations to assist user input.
    "Six","Seven","Eight","Nine"
  }  NT[0]="Zero"
  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,0           
-- 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.
  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()


------------------------------------------------------------------------------
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

Reply via email to