1. Floating Child Windows

Applications like Paint Shop Pro and PhotoShop have floating toolbars
that don't lose focus when the main window is selected (their titlebars
don't go dim). How is that behavior achieved? Are these special toolbar
windows? child or toplevel windows with special properties?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: Floating Child Windows

> Applications like Paint Shop Pro and PhotoShop have floating toolbars
> that don't lose focus when the main window is selected (their titlebars
> don't go dim). How is that behavior achieved? Are these special toolbar
> windows? child or toplevel windows with special properties?
> 
> -=ck

Their cheating.  Its not a real title bar.  It is basically a blank child
window with a title bar painted on it.  They toggle the dim look or re-enable
depending on the focus of the parent window.

If I remember the right API it is DrawFrameControl with type of DFC_CAPTION?


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Floating Child Windows

Don wrote:
> 
> > Applications like Paint Shop Pro and PhotoShop have floating toolbars
> > that don't lose focus when the main window is selected (their titlebars
> > don't go dim). How is that behavior achieved? Are these special toolbar
> > windows? child or toplevel windows with special properties?
> 
> Their cheating.  Its not a real title bar.  It is basically a blank child
> window with a title bar painted on it.  They toggle the dim look or re-enable
> depending on the focus of the parent window.

Those unscrupulous buckets of scum! Oh well. Thanks, Don! Is that how
they get those tiny titlebars with the tiny close buttons with the
itty-bitty 'x'?

Actually, I just looked at the Win32Lib's EX18.EXW demo... it uses
the WS_EX_TOOLWINDOW parameter! hmmmmm. a clue even I can consider!!! :D

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » goto parent     » topic index » view message » categorize

4. Re: Floating Child Windows

> > > Applications like Paint Shop Pro and PhotoShop have floating toolbars
> > > that don't lose focus when the main window is selected (their titlebars
> > > don't go dim). How is that behavior achieved? Are these special toolbar
> > > windows? child or toplevel windows with special properties?
> > 
> > Their cheating.  Its not a real title bar.  It is basically a blank child
> > window with a title bar painted on it.  They toggle the dim look or
> > re-enable
> > depending on the focus of the parent window.
> 
> Those unscrupulous buckets of scum! Oh well. Thanks, Don! Is that how
> they get those tiny titlebars with the tiny close buttons with the
> itty-bitty 'x'?
> 
> Actually, I just looked at the Win32Lib's EX18.EXW demo... it uses
> the WS_EX_TOOLWINDOW parameter! hmmmmm. a clue even I can consider!!! :D

Yeah, usually they custom draw those things.  Like you found though the
itty-bitty 'x' buttons (WS_EX_TOOLWINDOW) are true tool windows.  I really
havent had much chance to play around with them as I dont use em much at
all in any of my personal code.


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: Floating Child Windows

> Yeah, usually they custom draw those things.  Like you found though the
> itty-bitty 'x' buttons (WS_EX_TOOLWINDOW) are true tool windows.  I really
> havent had much chance to play around with them as I dont use em much at
> all in any of my personal code.

Oh yeah I forgot to add on to my last reply...
If you are using a "normal" window (ie not drawn yourself) and you want
the window to stay active, you need to handle the WM_NCACTIVATE message...

if Msg = WM_NCACTIVATE then
    return( w32Func(xDefWindowProc,{hwnd,WM_NCACTIVATE,TRUE,lParam}) )
end if


Don Phillips - aka Graebel
     National Instruments
     mailto: eunexus @ yahoo.com

new topic     » goto parent     » topic index » view message » categorize

6. Re: Floating Child Windows

Here's how you fix those pesky popup toolwindow things. Soon to be=20
added to an IDE near you. There are comments in the code.

--IDE_docking.ew
--  Causes pop-up Windows to stay active...
--  Original concept from Catch22 Productions

sequence DockWindows

-- boring stuff to get it working. keep going down....
function dockMsgHandler(integer pSource, atom hWnd, atom iMsg, atom wParam,=
=20
atom lParam)
integer fKeepActive, fSyncOthers
fKeepActive = wParam
fSyncOthers = w32True

-- UNDOCUMENTED FEATURE:
-- If the other window being activated/deactivated
-- (i.e. NOT this one) is one of our popups, then go (or stay) active.
if find(getId(lParam), DockWindows) then
	fKeepActive = w32True
	fSyncOthers = w32False
end if

-- If this message was sent by the synchronise-loop (below)
-- then exit normally. If we don't do this, there will be an infinite loop!=

if find(lParam, {-1, #FFFFFFFF}) then
	return {w32Func(xDefWindowProc, {hWnd, WM_NCACTIVATE, fKeepActive, 0})}
end if

-- This window is about to change (inactive/active).
-- Sync all other popups to the same state
if fSyncOthers then
	for i = 1 to length(DockWindows) do
		-- DO NOT send this message to ourselves!!!!
		if not(find(getHandle(DockWindows[i]), {hWnd, lParam})) then
			VOID = sendMessage(DockWindows[i], WM_NCACTIVATE, fKeepActive, -1)
		end if
	end for
end if

	return {w32Func(xDefWindowProc, {hWnd, WM_NCACTIVATE, fKeepActive,=20
lParam})}
end function

procedure destroyHandler(integer self, integer event, sequence params)
	event = find(self, DockWindows)
	DockWindows = DockWindows[1..event - 1] & DockWindows[event +=20
1..length(DockWindows)]
end procedure

function enableHandler(integer pSource, atom hWnd, atom wMsg, atom wParam,=
=20
atom lParam)
-- Synchronise all toolwindows to the same state.
for i = 1 to length(DockWindows) do
	if DockWindows[i] != getId(hWnd) then
		setEnable(DockWindows[i], wParam)
	end if
end for

	-- just do the default
    return 0
end function

-- call createDockBar() just like createEx(), but you don't need to specify=
=20
the Window parameter.
global function createDockBar(sequence pCaption, atom pOwner,
	        object pLeft, object pTop, object pWidth, object pHeight,
	        object styleFlags, object exFlags)
integer dockWnd
dockWnd = createEx(Window, pCaption, pOwner, pLeft, pTop, pWidth, pHeight=
,=20
styleFlags, exFlags)

DockWindows &= dockWnd
setWinMsgHandler(dockWnd, WM_NCACTIVATE, routine_id("dockMsgHandler"))
setHandler(dockWnd, w32HDestroy, routine_id("destroyHandler"))

	return dockWnd
end function

-- This should contain any of your MAIN windows
DockWindows = {Controls, Form}
setWinMsgHandler(DockWindows, WM_NCACTIVATE, routine_id("dockMsgHandler"))
setHandler(DockWindows, w32HDestroy, routine_id("destroyHandler"))
setWinMsgHandler(Controls, WM_ENABLE, routine_id("enableHandler"))    --=
=20
*ONLY* use for your *MAIN* windows....


~[ WingZone ]~
http://wingzone.tripod.com/

s=20
to offer.=20=20
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=10=
34&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines=20
  Start enjoying all the benefits of MSN=AE Premium right now and get the=
=20
first two months FREE*.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu