Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Pane Opacity
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Pane Opacity

 Post Reply Post Reply
Author
Message
mrmathis View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 May 2007
Location: United States
Status: Offline
Points: 105
Post Options Post Options   Thanks (0) Thanks(0)   Quote mrmathis Quote  Post ReplyReply Direct Link To This Post Topic: Pane Opacity
    Posted: 01 September 2009 at 1:34pm
I've been playing with the opacity setting of floating panes using CXTPDockingPaneManager::SetFloatingFramesOpacity and see some potential uses.  Is there an equivalent for unpinned panes, so that they would slide out in an opaque state?  If not, might that be on the horizon?
 
 
--Mike
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 02 September 2009 at 7:10am
Hi,
 
Windows doesn't support Opacity for Child windows - only for TopLevel. :(
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
mrmathis View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 May 2007
Location: United States
Status: Offline
Points: 105
Post Options Post Options   Thanks (0) Thanks(0)   Quote mrmathis Quote  Post ReplyReply Direct Link To This Post Posted: 02 September 2009 at 10:31am
That's too bad. 
 
With the floating panes, is there any way I could further manipulate things so that, say, the background would appear completely transparent?  For example, say a pane contains a tree control.  I'd like for the tree elements to be 50% opaque, but the background of the control to be invisible.
--Mike
Back to Top
mfproudman View Drop Down
Newbie
Newbie


Joined: 08 May 2008
Location: Canada
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote mfproudman Quote  Post ReplyReply Direct Link To This Post Posted: 08 September 2009 at 2:00pm

This may be related:  I've been trying to get a layered/transparent view working in a docking pane.

The following code works in a CDialog:

       HWND hWnd = GetSafeHwnd();
       long style = GetWindowLong(hWnd, GWL_EXSTYLE);
       style |= WS_EX_LAYERED;
       SetWindowLong(hWnd, GWL_EXSTYLE, style);
       ::SetLayeredWindowAttributes(hWnd, 0, 128, LWA_ALPHA);
       return 0;

It seems to have no effect in a CView attached to a CXTPDockingPane.  I have also tried with the hWnd from the docking pane, and also no effect.

What we're trying to do is have a docking pane containing a VISTA-like status gadget, with a transparent background.

Any ideas?

Mark Proudman

Mark Proudman
Back to Top
mrmathis View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 May 2007
Location: United States
Status: Offline
Points: 105
Post Options Post Options   Thanks (0) Thanks(0)   Quote mrmathis Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2009 at 2:35pm
Are you saying that works in a CDialog all by itself, or with a CDialog inside a docking pane?  I tried the latter and didn't have any success.
--Mike
Back to Top
mfproudman View Drop Down
Newbie
Newbie


Joined: 08 May 2008
Location: Canada
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote mfproudman Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2009 at 8:53am

It works in a CDialog popped-up with DoModal() completely outside a docking pane.  In other words, as was pointed out by Oleg, a top-level window can have WS_EX_LAYERED, but apparently not a DockingPane.

Or am I missing something here?  What we really want is a Docking Pane that becomes WS_EX_LAYERED as or if it is dragged into an undocked state.  In other words, when it is floating independently outside the app's mainframe, we want to be able to see through it to the windows it overlaps.  We're looking for something like a Vista gadget type of appearance for some dashboard style application state displays.

Any ideas?

Mark

Mark Proudman
Back to Top
mrmathis View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 May 2007
Location: United States
Status: Offline
Points: 105
Post Options Post Options   Thanks (0) Thanks(0)   Quote mrmathis Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2009 at 4:29pm
I've gotten back to this topic and had some luck with some experiments.  I went into CXTPDockingPaneMiniWnd::UpdateWindowOpacity and made these mods:
if (!m_bActive)
{
    ModifyStyleEx(0, WS_EX_LAYERED);
    // remove "real" call
    // pfnSetLayeredWindowAttributes(m_hWnd, 0x00, (BYTE)nFloatingFramesOpacity, LWA_ALPHA);
    // make the window transparent instead
    pfnSetLayeredWindowAttributes(m_hWnd, RGB(255,255,255), (BYTE)0, LWA_COLORKEY);
}
else
{
    // remove "real" call
    //pfnSetLayeredWindowAttributes(m_hWnd, 0x00, (BYTE)255, LWA_ALPHA);
    // make the window transparent instead
    pfnSetLayeredWindowAttributes(m_hWnd, RGB(255,255,255), (BYTE)0, LWA_COLORKEY);

}
Since the dialog in my docking pane is a tree control that fills the entire dialog, and its background color is white, the whole thing goes transparent very nicely, and I can click through it at will.  Now I'm playing with hiding the floating frame as well, while still providing some UI for moving/resizing/redocking/etc.
 
So, Codejock dev team, do you see any problem with this approach?  If not, how about exposing it, since subclassing is fragile (and I really haven't tried yet to make sure I can do it properly) and modifying the delivered source is not something I enjoy maintaining from release to release?
 
 
--Mike
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 21 December 2009 at 2:49am
Hi,
 
Yes, better create custom class for your Floating frames and override its UpdateWindowOpacity() method.
 
 
Here some code for start
 
 
 
class CDockingPaneMiniWnd : public CXTPDockingPaneMiniWnd
{
public:
 CDockingPaneMiniWnd(CXTPDockingPaneLayout* pLayout);
};
 

class CDockingPaneManager : public CXTPDockingPaneManager
{
public:
 CDockingPaneManager();
 virtual ~CDockingPaneManager();
protected:
 virtual CXTPDockingPaneBase* OnCreatePane(XTPDockingPaneType type, CXTPDockingPaneLayout* pLayout);
};
 
 
CDockingPaneManager::CDockingPaneManager()
{

}
CDockingPaneManager::~CDockingPaneManager()
{
}

CXTPDockingPaneBase* CDockingPaneManager::OnCreatePane(XTPDockingPaneType type, CXTPDockingPaneLayout* pLayout)
{
 if (type == xtpPaneTypeMiniWnd)
  return new CDockingPaneMiniWnd(pLayout);
 return CXTPDockingPaneManager::OnCreatePane(type, pLayout);
}
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.266 seconds.