Print Page | Close Window

Pane Opacity

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=15094
Printed Date: 19 April 2024 at 3:42pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Pane Opacity
Posted By: mrmathis
Subject: Pane Opacity
Date 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



Replies:
Posted By: Oleg
Date 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


Posted By: mrmathis
Date 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


Posted By: mfproudman
Date 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


Posted By: mrmathis
Date 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


Posted By: mfproudman
Date 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


Posted By: mrmathis
Date 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


Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net