> If you have an equally neat trick to solve the spinctrl's habit of replacing text with the internal numeric > value every time I hit the MAX or MIN limit, please show me. This is by far the more serious problem because > the internal handling updates the display but does not send a signal! That means there is likely no simple > way to prevent it doing this, except to detect any click as you showed in the first mail. >
---try this code you may it useful ---I use long name so I do need to comment (I am terrible at it) -- The fucntion GoingUp return the current control so only two functions are -- needed for the up and down frame = wx.wxFrame(wx.NULL, wx.wxID_ANY,'Test spin control') frame:Show(true) globalSpinControl=wx.wxSpinCtrl(frame) globalSpinControl:SetRange(10,40) local function GoingUp(event) local SpinCntrl = event:GetEventObject():DynamicCast('wxSpinCtrl') local mouseY, spRect = event:GetPosition().Y, SpinCntrl:GetRect() return event:GetEventObject():DynamicCast('wxSpinCtrl'), mouseY < spRect.Top + spRect.Height / 2 end local theValue = 0 local MOUSE_DOWN = function (event) print('in EVT_LEFT_DOWN') local localSpinControl, Up = GoingUp(event) theValue = localSpinControl.Value print(localSpinControl.Value, 'before') event:Skip() print(localSpinControl.Value, 'after') end local MOUSE_UP = function (event) print('in EVT_LEFT_UP') local localSpinControl, Up = GoingUp(event) local highHit, lowHit = false, false print('theValue:'..theValue, 'GoingUp? : ' , Up) print(localSpinControl.Value, 'before') event:Skip() print(localSpinControl.Value, 'after') --[[ localSpinControl.Value = 16 -- set the value here to what you want]] if Up then highHit = theValue == localSpinControl.Max else lowHit = theValue == localSpinControl.Min end print('highHit: '..tostring(highHit), 'lowHit: '..tostring(lowHit)) end globalSpinControl:Connect(wx.wxEVT_LEFT_UP, MOUSE_UP) globalSpinControl:Connect(wx.wxEVT_LEFT_DOWN, MOUSE_DOWN) wx.wxGetApp():MainLoop() A problem with this code is that if you hold the mouse down on a button it does not report a hi or lot hit properly. so maybe highHit = theValue == localSpinControl.Max or localSpinControl.Max == localSpinControl.Value would be a better test Andre Happy new year ------------------------------------------------------------------------------ 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