PDA

View Full Version : Close/Min/Maximize A Rollout (createDialog) with MS


decapitator
06-18-2008, 07:12 PM
Hello,

I've ran into something here.. What im trying to acomplish is to create custom buttons to; in my case close/minimize (but maximize aswell sometime) a rollout (createDialog). So that im able to create borderless dialogs without any styles.

I've found nothing of use so far, here on the forum and on google all I can think of isWindows.sendMessage <int HWND> <int message> <int messageParameter1> <int messageParameter2>Or even a dotNet command? (never touched dotNet)
But I have no idea how that would work or where I could find the answer for that.

What I did see was;if xrs_hwnd != undefined do windows.sendMessage xrs_hwnd[1] 0x0010 0 0 -- if found, send close messagein the manual but I dont know if that works (specially on minimize/maximize (since i can close with destroy dialog)) since I dont know how to get the Dialog's (rollout) HWND.

Greetings from Holland!

magicm
06-18-2008, 09:53 PM
You can do without any api calls, and use the built-in .placement property:
<rollout_floater>.placement Name, enums:{#minimized|#maximized|#normal}

This property gets/sets whether the dialog is minimized, maximized, or normal. This property will return 'undefined' if the rollout is a not in a dialog, or the dialog is a dialogBar or is in a viewport.

This property is valid for Rolloutfloaters that are not a dialogBar nor in a viewport.
Cheers,
Martijn

decapitator
06-19-2008, 08:23 AM
You can do without any api calls, and use the built-in .placement property:

Cheers,
MartijnThat looked good except for the fact that:"For example, if you set the property value to #maximized and #style_maximizebox was not specified in createDialog's style argument, no action occurs."So when I i tied it didnt work since im createDialog'n without any style's so no frame around it and no titlebar. It just kept on returning "#minimized" or "#maximized" without performing any actions.

Though the other thing that might occur would be that if it minimizes it would disapear becouse it has no titlebar so I dont know if this would work at all.

magicm
06-19-2008, 11:31 AM
This should do the trick:
rollout MinMaxTest "Minimize/Maximize Test" width:208 height:28
(
local MyHandle

local WM_SYSCOMMAND = 0x112
local SC_MINIMIZE = 0xf020
local SC_MAXIMIZE = 0xf030
local SC_RESTORE = 0xf120

button btnMinimize "Minimize" pos:[4,4] width:64 height:20
button btnMaximize "Maximize" pos:[72,4] width:64 height:20
button btnClose "Close" pos:[140,4] width:64 height:20

on btnMinimize pressed do
(
windows.sendMessage MyHandle WM_SYSCOMMAND SC_MINIMIZE 0
)

on btnMaximize pressed do
(
if MinMaxTest.placement == #maximized then
windows.sendMessage MyHandle WM_SYSCOMMAND SC_RESTORE 0
else
windows.sendMessage MyHandle WM_SYSCOMMAND SC_MAXIMIZE 0
)

on btnClose pressed do
(
destroyDialog MinMaxTest
)

on MinMaxTest open do
(
-- backup current title and set it to a unique string
local MyTitle = MinMaxTest.title
MinMaxTest.title = "__UnIqUe_TiTlE__"

-- get the rollouts handle using the UIAccessor interface
local OpenDialogs = UIAccessor.GetPopupDialogs()
local DialogTitles = for d in OpenDialogs collect (UIAccessor.GetWindowText d)
local DialogIndex = findItem DialogTitles "__UnIqUe_TiTlE__"
MyHandle = OpenDialogs[DialogIndex]

-- get the rollouts handle using the windows structure
-- local MaxWindows = windows.getChildrenHWND 0 parent:#max
-- local WindowTitles = for w in MaxWindows collect w[5]
-- local WindowIndex = findItem WindowTitles "__UnIqUe_TiTlE__"
-- MyHandle = MaxWindows[WindowIndex][1]

-- restore previous dialog title
MinMaxTest.title = MyTitle
)
)

createDialog MinMaxTest style:#()
I've included two methods to get the rollout's handle. The first one is probably slightly faster because the 'GetPopupDialogs' method normally returns less windows than 'getChildrenHWND'.

When the dialog has been minimized you can doubleclick on the titlebar to restore it.

Martijn

decapitator
06-19-2008, 12:04 PM
This should do the trick:rollout MinMaxTest "Minimize/Maximize Test" width:208 height:28
(
local MyHandle

local WM_SYSCOMMAND = 0x112
local SC_MINIMIZE = 0xf020
local SC_MAXIMIZE = 0xf030
local SC_RESTORE = 0xf120
......Ah thanks alot Martijn ill try and play with it once my lunch break is over!

One last thing (for now atleast) though is there any good place to find those values, becouse I was browsing MSDN and had allready seen the SC_MINIMIZE etc but i cant find the values on the site so I cant experiment with other things since I dont know the values I need to send.

Jenne

ZeBoxx2
06-19-2008, 12:18 PM
is there any good place to find those values
Google for "winuser.h". For more esoteric ones, simply google for "define <variable name>".

decapitator
06-19-2008, 12:26 PM
Google for "winuser.h". For more esoteric ones, simply google for "define <variable name>".Allright Cheers

CGTalk Moderation
06-19-2008, 12:26 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.