Jump to content

Cancel button worked improperly when duplicating cluster save


LaoWang27
  • Pending

About

when duplicating a world, the cancel button is supposed to do nothing except PopScreen.

But if you hit the cancel button by Enter Key instead of mouse leftclick, copying still occurs.

 

 

How to fix

The cause is that KEY_ENTER and CONTROL_ACCEPT trigger OnTextEntered (of textedit widget) and onclick (of cancel button) respectively.

One of the way to fix it is:

screens/redux/inputdialog.lua

local InputDialogScreen = Class(Screen, function(self, title, buttons, modal, start_editing)
    ...
	self.bg:SetFocusChangeDir(MOVE_UP, self.edit_text)

	self.default_focus = self.edit_text

-- START
-- add these scripts at the bottom of class ctor
    local bg = self.bg
    self.edit_text.OnRawKey = function(self, key, down)
        return not bg.actions.focus and TextEdit.OnRawKey(self, key, down)
    end
    self.edit_text.OnControl = function(self, control, down)
        return not bg.actions.focus and TextEdit.OnControl(self, control, down)
    end	
-- END

end)

 

(Hack. there may be other, more elegant solutions.)


Steps to Reproduce

refer to Issue Description




User Feedback


There are no comments to display.



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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...