Skip to content

Commit c57289a

Browse files
committed
Use consistent hotkey layout for cancel/confirm
1 parent 23bec58 commit c57289a

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

gui/keybinds.lua

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,19 @@ function SelectKeyDialog:init()
9292
text = "WARNING: This keybind may be disruptive to gameplay.\nProceed cautiously.",
9393
visible = function() return self.warning end,
9494
},
95-
widgets.Label {
95+
widgets.HotkeyLabel {
9696
frame = { b = 0, l = 2 },
97+
key = 'SELECT',
98+
label = 'Confirm',
9799
auto_width = true,
98-
text_pen = COLOR_LIGHTGREEN,
99-
text = 'Confirm',
100100
enabled = function() return self.key ~= nil end,
101-
on_click = self:callback('onConfirm')
101+
on_activate = self:callback('onConfirm')
102102
},
103-
widgets.Label {
104-
frame = { b = 0, l = 12 },
103+
widgets.HotkeyLabel {
104+
frame = { b = 0, l = 18 },
105+
key = 'LEAVESCREEN',
106+
label = 'Cancel',
105107
auto_width = true,
106-
text_pen = COLOR_BROWN,
107-
text = 'Cancel',
108108
on_click = self:callback('onCancel')
109109
},
110110
},
@@ -131,19 +131,6 @@ function SelectKeyDialog:onIdle()
131131
end
132132
end
133133

134-
function SelectKeyDialog:onInput(keys)
135-
-- Handle Esc/Enter as Cancel/Confirm
136-
if keys.SELECT then
137-
self:onConfirm()
138-
return true
139-
end
140-
if keys.LEAVESCREEN then
141-
self:onCancel()
142-
return true
143-
end
144-
return SelectKeyDialog.super.onInput(self, keys)
145-
end
146-
147134
function SelectKeyDialog:onConfirm()
148135
-- Cancel ongoing input requests
149136
dfhack.hotkey.requestKeybindingInput(true)

0 commit comments

Comments
 (0)