Narrnika Posted July 5, 2020 Share Posted July 5, 2020 ...more precisely, the function works, but not correctly, because of which it seems that it does not work - the confirmation button is blocked and immediately becomes available again. an error in the function `ISTextBox:updateButtons()`, which is called every (frame update?) in `ISTextBox:prerender()` function ISTextBox:updateButtons() self.yes:setEnable(true); self.yes.tooltip = nil; local text = self.entry:getText() if self.validateFunc and self.validateText ~= text then self.validateText = text -- after that the next iteration doesn't check and self.yes.enable remains true local isValid = self.validateFunc(self.validateTarget, text, self.validateArgs[1], self.validateArgs[2]) self.yes:setEnable(isValid) end -- ... end I suggested changing the function a bit like this: function ISTextBox:updateButtons() self.yes:setEnable(true); self.yes.tooltip = nil; local text = self.entry:getText() if self.validateFunc and not self.validateFunc(self.validateTarget, text, self.validateArgs[1], self.validateArgs[2]) then self.yes:setEnable(false) self.yes.tooltip = self.validateText; end -- ... end here the check happens all the time, and `validateText` is used as a tooltip when button disable. Link to comment 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