Close/Min/Maximize A Rollout (createDialog) with MS

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2008   #1
Close/Min/Maximize A Rollout (createDialog) with MS

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 is
Windows.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 message
in 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!
__________________
Love and kisses your cousin Ted.
PS; My thumb hurts...

Last edited by decapitator : 06 June 2008 at 06:16 PM.
 
Old 06 June 2008   #2
You can do without any api calls, and use the built-in .placement property:
Quote: <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
 
Old 06 June 2008   #3
Originally Posted by magicm: You can do without any api calls, and use the built-in .placement property:

Cheers,
Martijn
That looked good except for the fact that:
Quote: "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.
__________________
Love and kisses your cousin Ted.
PS; My thumb hurts...
 
Old 06 June 2008   #4
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

Last edited by magicm : 06 June 2008 at 10:34 AM.
 
Old 06 June 2008   #5
Originally Posted by magicm: 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
__________________
Love and kisses your cousin Ted.
PS; My thumb hurts...
 
Old 06 June 2008   #6
Originally Posted by decapitator: is there any good place to find those values

Google for "winuser.h". For more esoteric ones, simply google for "define <variable name>".
 
Old 06 June 2008   #7
Originally Posted by ZeBoxx2: Google for "winuser.h". For more esoteric ones, simply google for "define <variable name>".
Allright Cheers
__________________
Love and kisses your cousin Ted.
PS; My thumb hurts...
 
Old 06 June 2008   #8
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:04 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.