Skip to content

Commit

Permalink
Add close on Escape
Browse files Browse the repository at this point in the history
  • Loading branch information
1337LutZ committed Aug 3, 2024
1 parent 0c57b51 commit 5867976
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions UI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ function UI:CreateMainWindow(classIsSupported, simLink)
frame:SetTitle("WowSimsExporter " .. Env.VERSION .. "")
frame:SetStatusText("Click 'Generate Data' to generate exportable data")
frame:SetLayout("Flow")

-- Add the frame as a global variable under the name `WowSimsExporter`
_G["WowSimsExporter"] = frame.frame
-- Register the global variable `WowSimsExporter` as a "special frame"
-- so that it is closed when the escape key is pressed.
tinsert(UISpecialFrames, "WowSimsExporter")

_frame = frame

local icon = AceGUI:Create("Icon")
Expand Down Expand Up @@ -108,6 +115,9 @@ into the provided box and click "Import"
jsonbox:SetFullWidth(true)
jsonbox:SetFullHeight(true)
jsonbox:DisableButton(true)
jsonbox.editBox:SetScript("OnEscapePressed", function(self)
OnClose(frame)
end)
frame:AddChild(jsonbox)

_jsonbox = jsonbox
Expand Down

0 comments on commit 5867976

Please sign in to comment.