|
Hi Konstantin,
This compiles OK here:
class CFilterView : public aero::CWindowImpl<CFilterView, CEdit>
{
public:
typedef aero::CWindowImpl<CFilterView, CEdit> baseClass;
BEGIN_MSG_MAP(CFilterView)
CHAIN_MSG_MAP(baseClass)
END_MSG_MAP()
};
You will have to handle at least all messages in aero::CEdit message map for correct painting of your control.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
modified on Tuesday, August 24, 2010 5:40 AM
|
|
|
|
|
Hi Alain,
thank you! It compiles well now and I'm looking for example how to handle the messages. Would you recommend an article or example that can be used as analogy for the purpose of drawing CEdit?
I had also another thought - maybe it can be implemented as CEditView, i.e.
CCtrlImpl<CFilterView, WTL::CEditViewImpl<CFilterView> > ? In this case I will have to implement CEditView.
Konstantin
|
|
|
|
|
Hi Konstantin,
This can be a starting point:
class CFilterView : public aero::CWindowImpl<CFilterView, CEdit>
{
public:
typedef aero::CWindowImpl<CFilterView, CEdit> baseClass;
void Paint(CDCHandle dc, RECT& , RECT& , RECT& rDest)
{
DefWindowProc(WM_PAINT, (WPARAM)dc.m_hDC, 0);
if (m_BufferedPaint.m_hPaintBuffer)
m_BufferedPaint.MakeOpaque(&rDest);
}
BEGIN_MSG_MAP(CFilterView)
CHAIN_MSG_MAP(baseClass)
MESSAGE_HANDLER(EM_SETSEL, OnRedraw)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnRedraw)
MESSAGE_HANDLER(WM_MOUSEMOVE, OnRedraw)
MESSAGE_HANDLER(WM_KEYDOWN, OnRedraw)
MESSAGE_HANDLER(WM_PASTE, OnRedraw)
END_MSG_MAP()
LRESULT OnRedraw(UINT , WPARAM , LPARAM , BOOL& )
{
DefWindowProc();
Invalidate(FALSE);
return 0;
}
};
Konstantin Izmailov wrote: I had also another thought - maybe it can be implemented as CEditView
KISS
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
|
im getting this error when i compiled your AeroDialog sample.
Error 2 error C2039: 'CTabViewImpl' : is not a member of 'WTL' aerosamples\aerosamples\wtlaero.h 1292 AeroDialog
Error 3 error C2065: 'CTabViewImpl' : undeclared identifier aerosamples\aerosamples\wtlaero.h 1292 AeroDialog
Error 4 error C2275: 'WTL::aero::CTabView' : illegal use of this type as an expression aerosamples\aerosamples\wtlaero.h 1292 AeroDialog
Error 5 error C2955: 'WTL::aero::CCtrlImpl' : use of class template requires template argument list aerosamples\aerosamples\wtlaero.h 1292 AeroDialog
Error 6 error C2143: syntax error : missing ',' before '>' aerosamples\aerosamples\wtlaero.h 1292 AeroDialog
Error 7 fatal error C1903: unable to recover from previous error(s); stopping compilation aerosamples\aerosamples\wtlaero.h 1295 AeroDialog
reagrds,
|
|
|
|
|
Hi,
In AeroDialog.cpp
#include <atlctrlx.h> before #include "WtlAero.h" .
Sorry of this missing line
cheers,
AR
|
|
|
|
|
You have to add below to "wtlaero.h":
#include <atlctrlx.h>
it works for me.
|
|
|
|
|
Error 1 error C2039: CTabViewImpl ": not" WTL "the members of the
|
|
|
|
|
my project is ocurred an error
=>syntax error : identification PICONINFOEX??
WHY??
|
|
|
|
|
If you can compile the article samples, you probably forgot to change the constants in stdafx.h as indicated in the article (see Guided tour Step 1[^]).
Otherwise your system is not correctly configured to compile for Vista targets. Give more details on your development platform and compiler.
cheers,
AR
|
|
|
|
|
Thank you for your kind answer~!
but I have a lot of problems as before..
I use Visulal Studio 2005 SP1 under Windows XP
and I installed Microsoft® Windows® Software Development Kit Update for Windows Vista™ because your link was failed.
and I installed WTL8.0 beta2
and I changed contents in stdafx.h
#define WINVER 0x0600
#define _WIN32_WINNT 0x0600
#define _WIN32_IE 0x0700
#define _RICHEDIT_VER 0x0200
but I can't compile in this step
help me
Thank you
|
|
|
|
|
Can you compile the samples in AeroSamples.zip?
AR
|
|
|
|
|
No I can't compile AeroSamples
this is the same error my test project
syntax error in atlctrls.h
PBUTTON_SPLITINFO
LPLVFOOTERINFO
PLVITEMINDEX
TVITEMPART
etc...
|
|
|
|
|
Include the Vista SDK headers instead of the original VS 2005 ones. Change the Tool->Options->Projects->VC++ include directories to get that.
cheers,
AR
|
|
|
|
|
it's easier to run the Integrate Windows SDK with Visual Studio 2005 shortcut which lives under the Microsoft SDK start menu entry
|
|
|
|
|
this program require the new sdk ,PICONINFOEX is defined in the vista sdk ,xp can not compile ,sorry for my poor English
|
|
|
|
|
Hi alain,
i have tried you example, but it failed because i can't create the Toolbar this way.
I think AtlCreateSimpleToolBar() is made for use with FrameWindows. So i decided to
use "my" toolbar, created from scratch
CToolBarCtrl tb;<br />
DWORD dwStyle = WS_CHILDWINDOW|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|TBSTYLE_TRANSPARENT|TBSTYLE_CUSTOMERASE|TBSTYLE_LIST|TBSTYLE_FLAT|CCS_NODIVIDER|CCS_TOP;<br />
DWORD dwExStyle = WS_EX_LEFT|WS_EX_LTRREADING|WS_EX_RIGHTSCROLLBAR|TBSTYLE_EX_DRAWDDARROWS|TBSTYLE_EX_DOUBLEBUFFER;<br />
tb.Create(m_hWnd, 0, 0, dwStyle, dwExStyle);<br />
tb.SetStyle(dwStyle);<br />
tb.SetExtendedStyle(dwExStyle);<br />
<br />
TBBUTTON tbButtons[] =<br />
{<br />
{0, 100, TBSTATE_ENABLED, BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN, 0, 0L, 0},<br />
{1, 101, TBSTATE_ENABLED, BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN, 0, 0L, 0},<br />
{2, 102, TBSTATE_ENABLED, BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN, 0, 0L, 0},<br />
{3, 103, TBSTATE_ENABLED, BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN, 0, 0L, 0},<br />
{4, 104, TBSTATE_ENABLED, BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN, 0, 0L, 0},<br />
{5, 105, TBSTATE_ENABLED, BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN, 0, 0L, 0},<br />
{6, 106, TBSTATE_ENABLED, BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN, 0, 0L, 0},<br />
};<br />
tb.SetButtonStructSize();<br />
int count = sizeof tbButtons / sizeof TBBUTTON;<br />
for (int i = 0; i < count; ++i)<br />
{<br />
ATL::CString text;<br />
if (i == 3)<br />
{<br />
text.Format(_T("Mein Lieblings-Button: %d"), i);<br />
}<br />
else<br />
{<br />
text.Format(_T("Button: %d"), i);<br />
}<br />
tbButtons[i].iString = tb.AddStrings(text);<br />
}<br />
tb.SetBitmapSize(0, 0);<br />
tb.AddButtons(count, tbButtons);<br />
tb.AutoSize();
But this way i got assertions in OnPaint, because CBufferedPaintImpl looks for an
ImageList and its Icons. After ignoring this assertions the toolbar lokes like a
thin white line. A little bit later the crash comes.
In my standard-application this toolbar works without problems. Any ideas from you ??
best regards
JJ
|
|
|
|
|
Jürgen,
Please edit your post for shorter lines as CodeProject doesn't like wide code lines
Jürgen Jung wrote: I think AtlCreateSimpleToolBar() is made for use with FrameWindows. So i decided to
AtlCreateSimpleToolBar() works with any window, but creates simple toolbars from a RT_TOOLBAR resource.
aero::CToolBarCtrl is presently designed for these simple toolbars and has no button text support.
Provide a different base class to aero::CCtrl , for instance:
class CMyTextToolBar : public WTL::CToolBarCtrl
{};
typedef aero::CCtrl<CMyTextToolBar> CMyAeroTextToolBar;
inline LPCWSTR CMyAeroTextToolBar::GetThemeName()
{
return L"TOOLBAR";
};
Provide a specialized drawing routine using DrawCtrlText() members (see in WtlAero.h the specialized CToolBarCtrl::CtrlPaint ).
inline void CMyAeroTextToolBar::CtrlPaint(HDC hdc, RECT& , RECT& rPaint)
{
Then subclass and make opaque as indicated here[^].
cheers,
AR
modified on Wednesday, January 16, 2008 7:34:23 AM
|
|
|
|
|
Hi Alain,
now i see my toolbar, or something that looks like a toolbar.
Afterwards i controlled my dialog and his childs with spy++
and i still see a toolbar-window as a thin white line below
the text-buttons of my glass-toolbar.
In the specialized CtrlPaint i dray my text. I am afraid i must
paint the dropdown-arrows of the button also myself, right ?
thanks a lot
JJ
|
|
|
|
|
Hi Jürgen,
Glad to help.
Jürgen Jung wrote: I am afraid i must
paint the dropdown-arrows of the button also myself, right ?
You should get them painted by the theme API. They are parts of the button: see vsstyle.h line #1260 and under.
Keep in touch, your work may contribute to the next version.
cheers,
AR
|
|
|
|
|
Hi Alain,
at least i got everything running. Though it was not what i need. The main
reason for all this work was to use the result to build an activeX-Toolbar
with glass. That means, the control, which should be positioned somewhere on
a parent form, should enable glass for itself and ONLY for itself
independant from the parent-window, if allowed by the system-envorinment.
But as far as i can see, your method and all others i have seen, always
needs a parent to do DwmExtendFrameIntoClientArea() for the "child-area" to
allow the child-controls to be shown with glass, and thats not what i wanted.
best regards
JJ
|
|
|
|
|
Hi Jürgen
Jürgen Jung wrote: at least i got everything running
Some satisfaction for me here
Jürgen Jung wrote: But as far as i can see, your method and all others i have seen, always
needs a parent to do DwmExtendFrameIntoClientArea() for the "child-area" to
allow the child-controls to be shown with glass, and thats not what i wanted.
You might investigate that issue with a simple aero::CWindowImpl derived window calling ::DwmEnableBlurBehindWindow()[^] on it's parent.
If this can work, you will probably need a full subclassing of the system toolbar control through aero::CCtrlImpl as aero::CCtrl is only designed for easy common controls drawing specialization. Hard work ahead
Thanks for keeping me informed.
cheers,
AR
|
|
|
|
|
I know this is a bit different to your article but I have found nothing. In my C# app I have a menuStrip which is over an Aero area. The problem is that the Text goes see-through. I've seen posts saying for labels you should use some Drawing class instead of a label. but for a menuStrip it's a bit harder. Any ideas how to make it like yours?
|
|
|
|
|
Hi Chris,
I am afraid I am of little help here, as I have no practical C# experience.
See in WtlAero.h the code for aero::CCommandBarCtrl::OnParentCustomDraw() , that's where the menu painting occurs into a system buffered DC. Note that the parent frame reflects the NM_CUSTOMDRAW notification, so you may as well locate equivalent code in the parent form.
Good luck,
AR
|
|
|
|
|
Hi Alain,
I would not so much describe my article as an "MFC cousin article" since it describes techniques you can use without any framework at all, be it MFC or ATL.
Anyway: Nice article. Keep on the good work!
--
Stefan
|
|
|
|
|