rexih Posted December 31, 2014 Share Posted December 31, 2014 i want to close the check for valid characters, here is the orginal code:function TextEdit:OnTextInput(text) if not self.editing then return end if not self.shown then return end if self.limit then local str = self:GetString() --print("len", string.len(str), "limit", self.limit) if string.len(str) >= self.limit then return end end if self.validchars then if not string.find(self.validchars, text, 1, true) then return end end self.inst.TextEditWidget:OnTextInput(text)endand i use AddClassPostConstruct to do it,but i turns out wrongAddClassPostConstruct("widgets/textedit", function(self,...) if not self.OnTextInput then return end --self.OnTextInput(...) self.OldOnTextInput=self.OnTextInput local function NewOnTextInput(self,text) self.OldOnTextInput(text) if not self.editing then return end if not self.shown then return end if self.limit then local str = self:GetString() --print("len", string.len(str), "limit", self.limit) if string.len(str) >= self.limit then return end end --to comment -- if self.validchars then -- if not string.find(self.validchars, text, 1, true) then -- return -- end -- end self.inst.TextEditWidget:OnTextInput(text) end self.OnTextInput=NewOnTextInputend)so ,so coule anyone help me Link to comment https://forums.kleientertainment.com/forums/topic/48022-how-to-overwrite-texteditontextinputtext/ Share on other sites More sharing options...
rexih Posted December 31, 2014 Author Share Posted December 31, 2014 e。。。。。。something weird,i open the game again it works! and self.OldOnTextInput(text) is not nessesary Link to comment https://forums.kleientertainment.com/forums/topic/48022-how-to-overwrite-texteditontextinputtext/#findComment-595012 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now