remember position

This commit is contained in:
DaniTheSkunk 2022-12-09 07:17:52 +00:00
parent 893dc95335
commit df414ebfdb
1 changed files with 46 additions and 6 deletions

View File

@ -1,10 +1,50 @@
local dlg
function init(plugin) function init(plugin)
plugin:newCommand { plugin:newCommand {
id = "SkunkTest", id = "SkunkTest",
title = "Skunk Test", title = "Skunk Test",
group = "cel_popup_properties", group = "cel_popup_properties",
onclick = function() onclick = function()
app.alert("meow!") dlg = Dialog{
title = "AseSkunk",
onclose = function()
save_dlg_bounds(plugin)
end
}
dlg:button {
text = "meow",
onclick = function()
end
}
dlg:show {
wait = false
}
load_dlg_bounds(plugin)
end end
} }
end end
function save_dlg_bounds(plugin)
plugin.preferences.dlg_bounds_x = dlg.bounds.x
plugin.preferences.dlg_bounds_y = dlg.bounds.y
plugin.preferences.dlg_bounds_width = dlg.bounds.width
plugin.preferences.dlg_bounds_height = dlg.bounds.height
end
function load_dlg_bounds(plugin)
if plugin.preferences.dlg_bounds_x then
app.alert("loading!")
dlg.bounds = Rectangle(
plugin.preferences.dlg_bounds_x,
plugin.preferences.dlg_bounds_y,
plugin.preferences.dlg_bounds_width,
plugin.preferences.dlg_bounds_height
)
end
end
function exit(plugin)
save_dlg_bounds(plugin)
end