You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(60) |
Jul
(35) |
Aug
(32) |
Sep
(5) |
Oct
(5) |
Nov
(58) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(114) |
Feb
(184) |
Mar
(153) |
Apr
(90) |
May
(153) |
Jun
(59) |
Jul
(24) |
Aug
(43) |
Sep
(17) |
Oct
(34) |
Nov
(11) |
Dec
(204) |
2007 |
Jan
(84) |
Feb
(119) |
Mar
(38) |
Apr
(28) |
May
(52) |
Jun
(105) |
Jul
(64) |
Aug
(67) |
Sep
(14) |
Oct
(3) |
Nov
(28) |
Dec
(55) |
2008 |
Jan
(228) |
Feb
(55) |
Mar
(30) |
Apr
(30) |
May
(15) |
Jun
(20) |
Jul
(12) |
Aug
(3) |
Sep
(13) |
Oct
(54) |
Nov
(35) |
Dec
(35) |
2009 |
Jan
(19) |
Feb
(20) |
Mar
(34) |
Apr
(4) |
May
(60) |
Jun
(25) |
Jul
(16) |
Aug
(51) |
Sep
(19) |
Oct
(62) |
Nov
(21) |
Dec
(12) |
2010 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
(12) |
May
(23) |
Jun
(13) |
Jul
(1) |
Aug
(40) |
Sep
(18) |
Oct
(21) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(17) |
Feb
(23) |
Mar
(1) |
Apr
(10) |
May
(1) |
Jun
(5) |
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(43) |
2012 |
Jan
(5) |
Feb
(19) |
Mar
(6) |
Apr
(24) |
May
(39) |
Jun
(83) |
Jul
(29) |
Aug
(36) |
Sep
(64) |
Oct
(55) |
Nov
(12) |
Dec
(7) |
2013 |
Jan
(17) |
Feb
(10) |
Mar
(37) |
Apr
(27) |
May
(13) |
Jun
(9) |
Jul
(7) |
Aug
(61) |
Sep
(23) |
Oct
(23) |
Nov
(30) |
Dec
(16) |
2014 |
Jan
(23) |
Feb
(13) |
Mar
(9) |
Apr
(17) |
May
(2) |
Jun
(11) |
Jul
(2) |
Aug
|
Sep
(9) |
Oct
(24) |
Nov
(2) |
Dec
(14) |
2015 |
Jan
(6) |
Feb
(4) |
Mar
(17) |
Apr
|
May
(7) |
Jun
(3) |
Jul
|
Aug
|
Sep
(2) |
Oct
(21) |
Nov
(6) |
Dec
(2) |
2016 |
Jan
(4) |
Feb
(2) |
Mar
(7) |
Apr
(3) |
May
(11) |
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(4) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(8) |
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(3) |
2
|
3
(2) |
4
(2) |
5
|
6
(2) |
7
|
8
(1) |
9
(2) |
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
29
(6) |
30
(10) |
31
(6) |
|
From: Lostgallifreyan <z....@bt...> - 2010-12-31 22:06:44
|
Lostgallifreyan <z....@bt...> 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() |
From: Lostgallifreyan <z....@bt...> - 2010-12-31 22:02:30
|
Andre Arpin <ar...@ki...> wrote: (31/12/2010 21:07) >note given: text = wx.wxTextCtrl(... >then > >v = text.Value >v = text[Value] >v = text:GetValue() >v = text.GetValue(text) > >are all equivalent > Which is nice but I'd hoped it cut both ways. :) Sadly, while EV.Id neatly replaces EV:GetId(), you can't do SC.Value=SC.Value.."text" to force text replacement in a SpinCtrl derived directly from its own value, but you CAN do it with SC:SetValue(SC.Value.."text"). I guess I can either use the dot for reading but not writing, or stay with Set and Get for symmetry... Both approaches seem useful to me. |
From: Andre A. <ar...@ki...> - 2010-12-31 21:08:19
|
Lostgallifreyan <z.crow@...> writes: > That's my problem, remembering rules is hard without understanding, and this goes deeper than I know how to > go. Even 'syntactic sugar', which I have often seen mentioned, confuses me, but I take it to mean a way of > easing the readability of code that associates values, functions, with each other. If so, I'm all for it > because I chose Lua because I can read it, think it, as I do with spoken language, and this is impossible with > C, at least for me... The practical question is: which constructs in a language as alive and mutable as Lua > (wxLua, wxWidgets) will remain archetypal? Some basics need to be consistent in the long term, or we will > be forever rewriting our code just to catch up with new Lua or wxLua releases. This, more than anything, > drives me to ask questions instead of being able t > o find out stuff for myself (which I do at least 95% of the time anyway). The more of these method remain in use > the better; freedom does matter, I agree. > The . : notation is well embedded into Lua. The extensions to wxlua of the . notation is to present more a c++ flavour (so I think) to wxlua. This is a more elegant notation and perfectly suited to Lua as well. On the other hand Lua extend it's notation with a . for table more syntactic sugar. (Programming languages are bad for diabetic.) In Lua a.b === a['b'] where a.b is a very welcome extention. Also a:f(...) === f(a, ...) wxlua make extensive use of this extension as well. I do not expect this syntax to ever change in the future. Andre note given: text = wx.wxTextCtrl(... then v = text.Value v = text[Value] v = text:GetValue() v = text.GetValue(text) are all equivalent |
From: Lostgallifreyan <z....@bt...> - 2010-12-31 16:40:18
|
Andre Arpin <ar...@ki...> wrote: (31/12/2010 00:11) > >Lostgallifreyan <z.crow@...> writes: > >> >> Small syntactic question... >> Andre's code in another thread used a dot, the results are neater than the >colon I learned to use.... >> >> ST:SetLabel(SC:GetValue() >> ST.Label=SC.Value >> >> I imagine this is an old issue so I'll keep this short: >> Is one of these methods to be deprecated (made obsolete), and if so, which? >> >> Ok, one more question: >> Is there a case where the two methods are NOT equivalent, and if so, what? > >The . is valid but a trick within wxlua. >Get..., Set... are supported. > I should have known there was no simple answer to a deceptively simple question. :) Such is code... Is the dot notation also valid in Lua too? I suspect it is, but I need to know if it might likely stay that way. I like your way of writing it, so I'll try it to see how far I can take it without breaking stuff. >Set/GetValue become var.Value = or Foo = var.value >als note that Is is magic so >ww = wx.wxTopLevelWindow ... >then ww.IsActive works >Ok and Eof are also magic, sor var.Ok is useful > I recall that Lua's flexibility with naming things is extreme, I saw an example where Henry=print and so forth, so you could Henry("stuff") to the screen and the madness didn't end there either. >:) I take it this flexibility is partly what allows these alternative notations too? >Now var.Value is resolved in 2 steps (only the first time). > >resolution... >The index fail within the meta (either index/newindex) > >Now the argument must be single for the following to happen. >The index is added to the object, the code is rerun and now works. >In all subsequent call the index allready exist and this all works. >There is a small cost time and space. > >This is syntactic sugar like >function Foo(arg) etc in lua >is >Foo = Function(arg) etc > >Most language and system supports these type of things. >I find it more readable and I like it, other may not. > >Its a free world (sometime). > >Andre > >PS: I have rewritten the Lua editor to suggest all these variances by using >the dynamic binding support. So to me it is easy to use otherwise you have to >remember all the rules. > That's my problem, remembering rules is hard without understanding, and this goes deeper than I know how to go. Even 'syntactic sugar', which I have often seen mentioned, confuses me, but I take it to mean a way of easing the readability of code that associates values, functions, with each other. If so, I'm all for it because I chose Lua because I can read it, think it, as I do with spoken language, and this is impossible with C, at least for me... The practical question is: which constructs in a language as alive and mutable as Lua (wxLua, wxWidgets) will remain archetypal? Some basics need to be consistent in the long term, or we will be forever rewriting our code just to catch up with new Lua or wxLua releases. This, more than anything, drives me to ask questions instead of being able to find out stuff for myself (which I do at least 95% of the time anyway). The more of these method remain in use the better; freedom does matter, I agree. |
From: Lostgallifreyan <z....@bt...> - 2010-12-31 16:23:54
|
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...@ki...> 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 >wxl...@li... >https://lists.sourceforge.net/lists/listinfo/wxlua-users |
From: Andre A. <ar...@ki...> - 2010-12-31 00:12:27
|
Lostgallifreyan <z.crow@...> writes: > > Small syntactic question... > Andre's code in another thread used a dot, the results are neater than the colon I learned to use.... > > ST:SetLabel(SC:GetValue() > ST.Label=SC.Value > > I imagine this is an old issue so I'll keep this short: > Is one of these methods to be deprecated (made obsolete), and if so, which? > > Ok, one more question: > Is there a case where the two methods are NOT equivalent, and if so, what? The . is valid but a trick within wxlua. Get..., Set... are supported. Set/GetValue become var.Value = or Foo = var.value als note that Is is magic so ww = wx.wxTopLevelWindow ... then ww.IsActive works Ok and Eof are also magic, sor var.Ok is useful Now var.Value is resolved in 2 steps (only the first time). resolution... The index fail within the meta (either index/newindex) Now the argument must be single for the following to happen. The index is added to the object, the code is rerun and now works. In all subsequent call the index allready exist and this all works. There is a small cost time and space. This is syntactic sugar like function Foo(arg) etc in lua is Foo = Function(arg) etc Most language and system supports these type of things. I find it more readable and I like it, other may not. Its a free world (sometime). Andre PS: I have rewritten the Lua editor to suggest all these variances by using the dynamic binding support. So to me it is easy to use otherwise you have to remember all the rules. |
From: Andre A. <ar...@ki...> - 2010-12-30 23:35:43
|
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 |
From: Lostgallifreyan <z....@bt...> - 2010-12-30 19:54:49
|
Small syntactic question... Andre's code in another thread used a dot, the results are neater than the colon I learned to use.... ST:SetLabel(SC:GetValue() ST.Label=SC.Value I imagine this is an old issue so I'll keep this short: Is one of these methods to be deprecated (made obsolete), and if so, which? Ok, one more question: Is there a case where the two methods are NOT equivalent, and if so, what? |
From: Lostgallifreyan <z....@bt...> - 2010-12-30 19:18:43
|
Andre Arpin <ar...@ki...> wrote: (30/12/2010 14:36) >function FeedBack(event) > local Id = event.Id > ..... old code for feed back >end > >for I=7,151 do > CT[I]:Connect(wx.wxEVT_KILL_FOCUS, FeedBack) >end I accidentally found an even better way! :) Make a dummy function that does nothing, and call that. So long as it does not end with Event:Skip() the internal display change (text replaced with lowest preset internal number value) does not occur on de-focus, so we don't need to force an update to replace the text. Again, this fails to solve the biggest problem because NO neat fixes like these ever work unless a signal is generated to which we can respond, even if the internal value does nto change because it's already at limit. I think it should ALWAYS be considered an 'update' if some explicit event attempted to cause a change in the internal value. This is the reason I am certain that Spinctrl is broken, and that this is not user error. This time I hope this filters right back up the chain of command to where the buck belongs. Someone up there needs to listen to this. |
From: Lostgallifreyan <z....@bt...> - 2010-12-30 19:03:22
|
Lostgallifreyan <z....@bt...> wrote: (30/12/2010 15:53) >>function FeedBack(event) >> local Id = event.Id >> ..... old code for feed back >>end >> >>for I=7,151 do >> CT[I]:Connect(wx.wxEVT_KILL_FOCUS, FeedBack) >>end >> > >.....I see your point, but I have other calls to FeedBack() that have an ID, are not event driven. If I could test for variable type at the start of FeedBack() this might work, possibly? I don't know if the event passed to a variable HAS a type, in the Lua sense of the word... > Andre, your code works fine for the de-focus bit now, with the first line of FeedBack being: if type(ID)=="userdata" then ID=ID:GetId() end This is neat enough to please me well, though it still leaves SpinCtrl's event signals wanting. If they'd just let us have the update signal every time an internal update occured, we'd be ok. Either that or NO internal update occurs if no signal is sent. But "signal always" (whether the internal update occurs by text entry, arrow keys, button click, mousewheel, de-focus, or anything else) MUST be the better choice, because that lets us code fixes which is otherwise impossible. |
From: Lostgallifreyan <z....@bt...> - 2010-12-30 18:52:18
|
I couldn't run that one... it throws errors I can't even interpret with my limited knowledge. Lack of 'strict' to require, whatever it is.., lack of value for #textControls, some of the error messages I saw resulting from my attempts to fix this had so many lines I didn't even try to diagnose them. After correcting a linewrap and omitting the first three lines of code I saw a displayed frame but it looks like this is all headed in directions I really don't want to go. > maybe wxEVT_COMMAND_SPINCTRL_UPDATED might work I did not try it. First thing I tried. This is the core of the problem, because it doesn't work! If the value does not change because it is already at set limit, no event signal is sent, so we cannot handle this case, ever! This is where we need to return to my first mail and consider the implications deeply. > 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 :) Well, yes. :) That's sort of the point. Like I said in the first mail, we often need to show the user a list of stuff like thread sizes, musical note values... The original Spinctrl could handle this. Any valid (in-range) numeric input typed and entered would work, and my FeedBack() function would update the Spinctrl with a text display that made much better sense to the user than the number, which the machine was better able to use. So everyone's happy. Or they were, until some wiseguy broke Spinctrl! Andre Arpin <ar...@ki...> wrote: (30/12/2010 18:23) >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 >wxl...@li... >https://lists.sourceforge.net/lists/listinfo/wxlua-users |
From: Andre A. <ar...@ki...> - 2010-12-30 18:24:16
|
> 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 |
From: Lostgallifreyan <z....@bt...> - 2010-12-30 16:05:08
|
Andre Arpin <ar...@ki...> wrote: (30/12/2010 15:47) >> 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 > 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! One thing I found was an UpdateUI event or some such. It forced update at all times though, so it is a vicious cycle that detects its own updates, updates again, chewing as much of my CPU time as ti can get a hold of. :) If I could find somethingsimilar but a tad less trigger-happy it might solve this yet. |
From: Lostgallifreyan <z....@bt...> - 2010-12-30 15:54:08
|
Andre Arpin <ar...@ki...> wrote: (30/12/2010 14:36) >> for I=7,151 do >> CT[I]:Connect(wx.wxEVT_KILL_FOCUS, >> function(EV) FeedBack(EV:GetId()) end >> ) >> end >> > >> What about: >local function KILL_FOCUS(EV) FeedBack(EV:GetId() > >for I=7,151 do > CT[I]:Connect(wx.wxEVT_KILL_FOCUS, KILL_FOCUS) >end > > >151 pointers to one function > >better > >function FeedBack(event) > local Id = event.Id > ..... old code for feed back >end > >for I=7,151 do > CT[I]:Connect(wx.wxEVT_KILL_FOCUS, FeedBack) >end > This is a bit like focussing on a leaky tap in a burning building, given the other more serious problems with Spinctrl. I know attention to details matters, but not at the expense of the whole picture. I think this is why Spinctrl got broken in the first place! Too much specialisation... Not good for science in general. Certainly not good for code. That said, I'll bite. :) It's still worth discussing. I see your point, but I have other calls to FeedBack() that have an ID, are not event driven. If I could test for variable type at the start of FeedBack() this might work, possibly? I don't know if the event passed to a variable HAS a type. in the Lua sense of the word... |
From: Andre A. <ar...@ki...> - 2010-12-30 15:48:09
|
> 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 |
From: Andre A. <ar...@ki...> - 2010-12-30 14:37:13
|
Lostgallifreyan <z.crow@...> writes: > > > Andre Arpin <arpin@...> wrote: > (29/12/2010 21:42) > > >sp:Connect(wx.wxEVT_KILL_FOCUS, > > function(event) > > print('k') > > end) > > > > Thanks again for this, it works great. > > I had to modify it to this: > > for I=7,151 do > CT[I]:Connect(wx.wxEVT_KILL_FOCUS, > function(EV) FeedBack(EV:GetId()) end > ) > end > > What about: local function KILL_FOCUS(EV) FeedBack(EV:GetId() for I=7,151 do CT[I]:Connect(wx.wxEVT_KILL_FOCUS, KILL_FOCUS) end 151 pointers to one function better function FeedBack(event) local Id = event.Id ..... old code for feed back end for I=7,151 do CT[I]:Connect(wx.wxEVT_KILL_FOCUS, FeedBack) end Andre |
From: Lostgallifreyan <z....@bt...> - 2010-12-29 22:28:13
|
Andre Arpin <ar...@ki...> wrote: (29/12/2010 21:42) >sp:Connect(wx.wxEVT_KILL_FOCUS, > function(event) > print('k') > end) > Thanks again for this, it works great. I had to modify it to this: for I=7,151 do CT[I]:Connect(wx.wxEVT_KILL_FOCUS, function(EV) FeedBack(EV:GetId()) end ) end ...because I have a largish number of spinctrls (which is why it angers me that they fail as they do now, an entire program is ruined if I can't resolve this, it depends almost entirely on spinctrls! 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. The problem with all this is that no matter how neat it is, that's now two functions, each connected to over 100 controls! This is NOT what people need, I thought the point of wxWidgets and wxLua was to enable fast easy building of programs, especially for those of us who don't know the depths behind the scenes. If I'm wrong about this, I doubt the control would ever have worked this way without this extra coding, but it did. All I ask (beyond any specific problem) is that it do so again, because instead of remembering basic use of a spinctrl I now have to keep a library of extra code just to get its original basic behaviour. |
From: Lostgallifreyan <z....@bt...> - 2010-12-29 22:01:18
|
Andre Arpin <ar...@ki...> wrote: (29/12/2010 21:42) >sp:Connect(wx.wxEVT_KILL_FOCUS, > function(event) > print('k') > end) > Thanks. That one's useful, it solves one problem. I could use it to restore the original text display. That still leaves a need to fix the lack of signal from the spinctrl if the value is not changed. That needs more than a mouseclick, it has to detect the area of each button, which gets so complex that I might as well display my own bitmaps and click on them, it would be easier! None of which is what I want! I'm asking merely that the wxSpinctrl works as it used to. It worked fine before, now it's broken and doesn't let us have signals to intercept to overcome its new limitations. I think wxLua lets me make my own handler for events in another control, but even that won't help me if the event produces no initial signal at all. |
From: Lostgallifreyan <z....@bt...> - 2010-12-29 21:47:19
|
Andre Arpin <ar...@ki...> wrote: (29/12/2010 21:22) >Lostgallifreyan <z.crow@...> writes: > >> >> Is there a way to tell a wxSpinctrl to always send a signal when a button is >clicked, not just when the value >try > >this is a very long question I just try to anwer your 1st point. > >frame = wx.wxFrame(wx.NULL, wx.wxID_ANY,'') >frame:Show(true) >sp=wx.wxSpinCtrl(frame) >sp:SetRange(23,37) > >sp:Connect(wx.wxEVT_LEFT_UP, > function (event) > print('a') > event:Skip() > end) > >wx.wxGetApp():MainLoop() > >'a' is displayed on any click. > Thanks for the reply. I realise that I can do this, though I'd have to specify the exact relative area of each button so it knows which I clicked. That's a LOT of code, and as I cintend in my original mail, is a thorough defeat to the point of a spinctrl. Not only do I have to write code to override what cannot be overridden, am I now to have to write my own controls? THis doesn't only defeat the point of the spinctrl, it defeats the point of wxLua and wxWidgets. I turned to these because I did not know C, C++ and the Win32 API. Given how deep I have to go to overcome this, I'd have to take on a system that nullifies any need for wx-anything. |
From: Andre A. <ar...@ki...> - 2010-12-29 21:42:39
|
Lostgallifreyan <z.crow@...> writes: > try frame = wx.wxFrame(wx.NULL, wx.wxID_ANY,'') frame:Show(true) sp=wx.wxSpinCtrl(frame) sp:SetRange(10,40) sp:Connect(wx.wxEVT_LEFT_UP, function (event) print('up') event:Skip() end) sp:Connect(wx.wxEVT_KILL_FOCUS, function(event) print('k') end) wx.wxGetApp():MainLoop() You can enter any text in the control and focus does not change it. Andre |
From: Andre A. <ar...@ki...> - 2010-12-29 21:22:58
|
Lostgallifreyan <z.crow@...> writes: > > Is there a way to tell a wxSpinctrl to always send a signal when a button is clicked, not just when the value try this is a very long question I just try to anwer your 1st point. frame = wx.wxFrame(wx.NULL, wx.wxID_ANY,'') frame:Show(true) sp=wx.wxSpinCtrl(frame) sp:SetRange(23,37) sp:Connect(wx.wxEVT_LEFT_UP, function (event) print('a') event:Skip() end) wx.wxGetApp():MainLoop() 'a' is displayed on any click. |
From: Lostgallifreyan <z....@bt...> - 2010-12-29 19:58:40
|
Is there a way to tell a wxSpinctrl to always send a signal when a button is clicked, not just when the value changes (is updated)? Also, is there a way to tell it NOT to replace a displayed text string with its lowest preset numeric value whenever focus departs or other inadvertent user event occurs? What would be nice is two new 'styles' like ALWAYS_SIGNAL_EVENTS and NEVER_SELF_ADJUST, and as it's usually wise to use both, or neither, maybe just have one: EXTERNAL_HANDLING_ONLY. I looked at general window styles too, I can't find anything helpful for this problem there. It used to work as I like it on wxLua v2.54 but since wxLua v2.8.something it seems that someone (at wxWidgets perhaps) broke what was otherwise nicely working. No doubt someone wanted it to 'correct' itself in case of invalid input, but this was a BAD move because it's not their call as to what displayed string is invalid. Filtering to reject non-numeric deliberate input is good, but displayed text is our business, not theirs. In case of bad entry, reversion to LAST good value would be nice, instead of LOWEST as is currently used, this being something I have seen others cry out for... Sometimes we don't want a number displayed in a wxSpinctrl. For example, a musical scale transposition, while digitised as a number, is best displayed as a note value or tonal interval, the same logic might apply to a selection from a range of engineering threads or screw sizes. In this case the idea is to enter the number if you know it, otherwise select with buttons/arrow keys, all in a single control. This is no longer possible, which defeats the point of a spinctrl! The only way is to use two controls, a spinctrl sized to show only its buttons, and a textctrl to show the data. This fails to work well, not least because a nasty bug occurs! It the text ever exceeds the space to show it in the textctrl, the spinctrl's buttons get copied, redrawn as a functional ghost INSIDE the textctrl! (Functional as in you can click them, but no business results if you do, they just obscure text in the textctrl and cannot be dismissed once they appear. Also, if I want to click in the textctrl then use arrow keys or mousewheel to update the spinctrl I not only need two controls, but a lot of extra code! The whole point of the spinctrl, to combine the methods, is effectively ruined now. We might as well use the spinbutton (and textctrl) except that we're advised not to do so because spinbutton event signals aren't always available in some systems. If this degrades further, good things will not only be further broken, but perhaps taken away! Fat chance of encouraging anyone to write code if this happens... Rewriting a program to work on updated support is hard enough without having to work round breakages that used not to exist in earlier systems. 'Easy power'? Overcoming bugs like these is harder than learning C++ and the Win32 API which I now begin to regret not doing long ago. I tried inventing all kinds of workrounds for the failure in wxSpinctrl, setting wrap so it always updated with any click, adding 1 to MAX and -1 to MIN and clipping the fetched value myself with math.min() nested in math.max() and forcing update with the new value on the control manually after it sends a signal, and it still fails because it thinks no update occurred even when it had to have done, so all that results is the signal failure is displaced to the next button-click event! No matter what I try, I cannot overcome the bad internal handling. Even event(skip) fails to help here! If nothing else, THAT should always prevent self-'correction' so we can display our own text representations of its numeric value, but it doesn't. Even if it did, it doesn't allow us to get an update signal EVERY time either button is pressed so we can handle it as we want to. I'm angry about this because all the coder's talk of RTFM and 'learn to code' means nothing. How can we accept being left in the dark, expected to code our own handlers for stuff, if we are barred from intercepting internal handling, or not even given a signal to handle at all when a deliberate event like a button click occurs?! What's worse is that IT USED TO WORK FINE. This isn't progress! This might not be the best place to rant, but I think it's as good as any. There are posts all over the net now complaining of breakages in wxSpinctrl, so I know it's likely not wxLua breaking it at all, but I might as well air this in a place I'm used to because it's not irrelevant here. Feel free to point wxWidgets coders this way (Gmane, or Mail Archive) if you know any, I think they seriously need to read this one. |
From: Andre A. <ar...@ki...> - 2010-12-09 15:52:49
|
Andre Arpin <arpin@...> writes: > > in EvaluateExpr // an expression int nOldTop = lua_gettop(L); wxString rExpr = wxT("return ") + strExpr; wxLuaCharBuffer charbuf(rExpr); int nResult = luaL_loadbuffer(L, charbuf.GetData(), charbuf.Length(), "debug"); adding the "return" makes more sense otherwise the user has to write return Expression for the evaluation to work. Andre |
From: Andre A. <ar...@ki...> - 2010-12-09 14:57:18
|
Andre Arpin <arpin@...> writes: > > in EvaluateExpr > checking for local variables while (!fFound && lua_getstack(L, iLevel++, &ar) != 0) { int iIndex = 0; wxString name = lua2wx(lua_getlocal(L, &ar, ++iIndex)); while(!fFound && !name.IsEmpty()) { if (strExpr == name) { nReference = m_wxlState.wxluaR_Ref(-1, &wxlua_lreg_refs_key); fFound = true; lua_pop(L, 1); break; } lua_pop(L, 1); name = lua2wx(lua_getlocal(L, &ar, ++iIndex)); } } > This is the exact code Andre |
From: Andre A. <ar...@ki...> - 2010-12-08 16:08:10
|
in EvaluateExpr checking for local variables int iIndex = 0; wxString name = lua2wx(lua_getlocal(L, &ar, ++iIndex)); while(!name.IsEmpty()) { .... name = lua2wx(lua_getlocal(L, &ar, ++iIndex)); } this allows the local variables to be evaluated Andre |