Closed silentwings closed 8 years ago
Was about to write a response on mantis but beaten to it by you guys :) Anyway, this isn't an engine issue and neither is it a chili one. The problem is in your widget, you shouldn't set text in the editbox by modifying the .text property, but instead invoke the :SetText() method. Change line 793 in bgu_mainMenu.lua widget:
addScrollStack{name='widgetList',x='50%'},Chili.EditBox:New{name='widgetFilter',x=0,y=0,width = '35%',text=' Enter filter -> Hit Return, or -->',OnMouseDown = {function(obj) obj:SetText('') end}},
PS: You may also want to update your chili eventually
In addition, the new chili/editbox supports the "hint" field which you could use, so instead of
text=' Enter filter -> Hit Return, or -->'
use
hint=' Enter filter -> Hit Return, or -->'
I didn't write this code - but (1) The text field is not modified (ever, as far as I can see), in the line you quote it is only passed to the constructor in a table of arguments. (2) How is anyone supposed to tell which fields are safe to send as arguments to the constructor and which are only safe to set via wrapper functions? As far as I can see http://gajop.github.io/chiliui/modules/controls.editbox.html or the chili code itself makes no distinction,
All fields are safe to be set via constructors, but this isn't the issue here. The original code set the field in the OnMouseUp chili callback:
OnMouseDown = {function(obj) obj.text = '' end}
Regarding wrapper methods, they should always be used if they exist (e.g. if there's a SetX method, then you should call that instead of setting the .x property directly).
Oh, you are correct, I didn't scroll far enough right... thanks.
So, can you close this issue? :p
No, because I don't have any priviledges for this repository.
see https://springrts.com/mantis/view.php?id=5072 for details, maybe has already been fixed