Skip to content

Instantly share code, notes, and snippets.

@tpoveda
Last active July 29, 2020 09:54
Show Gist options
  • Save tpoveda/18407f78a0f4a7e4905dd02165484723 to your computer and use it in GitHub Desktop.
Save tpoveda/18407f78a0f4a7e4905dd02165484723 to your computer and use it in GitHub Desktop.
Creates a frameless MaxScript dialog with maximize/minimize/close buttons
rollout FramelessRollout "Frameless Rollout" width:210 height:25
(
local wndHandle
local WM_SYSCOMMAND = 0x112
local SC_MINIMIZE = 0xf020
local SC_MAXIMIZE = 0xf030
local SC_RESTORE = 0xf120
button min_btn "Minimize" pos:[4,4] width:64 height:20
button max_btn "Maximize" pos:[72,4] width:64 height:20
button close_btn "Close" pos:[140,4] width:64 height:20
on min_btn pressed do
(
windows.sendMessage wndHandle WM_SYSCOMMAND SC_MINIMIZE 0
)
on max_btn pressed do
(
if FramelessRollout.placement == #maximized then
windows.sendMessage wndHandle WM_SYSCOMMAND SC_RESTORE 0
else
windows.sendMessage wndHandle WM_SYSCOMMAND SC_MAXIMIZE 0
)
on close_btn pressed do
(
destroyDialog FramelessRollout
)
on FramelessRollout open do
(
local FramelessTitle = FramelessRollout.title
FramelessRollout.title = "__frameless_title_unique__"
local openDialogs = UIAccessor.GetPopupDialogs()
local dialogTitles = for d in openDialogs collect (UIAccessor.GetWindowText d)
local dialogIndex = findItem dialogTitles "__frameless_title_unique__"
wndHandle = openDialogs[dialogIndex]
FramelessRollout.title = FramelessTitle
)
)
createDialog FramelessRollout style:#()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment