Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ WTL
Hi all
 
I have a button class :
 

class CTransparentBtn : virtual public CWindowImpl<ctransparentbtn, WTL::CButton, CControlWinTraits>
{
// ...
};
and I've found this class for menu button from codeproject.com
 

namespace WTLEX
{
 
template <bool class="" tbase="WTL::CButton," twintraits="CControlWinTraits">
class ATL_NO_VTABLE CMenuButtonImpl : public CWindowImpl< T, TBase, TWinTraits>
{
// ...
};
 
class CMenuButton : public CMenuButtonImpl<false, CMenuButton>
{
// ...
};
 
} //namespace WTLEX</bool>
so How can I derive "CMenuButton" from "CTransparentBtn" to use CTransparentBtn's functions??
 
thank u in advance
Posted 20-May-11 23:16pm
Edited 21-May-11 1:16am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

you're still going to have to template your CTransparentBtn if you go the other way
 
template <class theClass, class theBase>
class CTransparentBtn : public CWindowImpl<theClass, theBase, CControlWinTraits>
 

then
 
template <class theClass,class theBase>
class ATL_NO_VTABLE CMenuButtonImpl : public CTransparentBtn <theClass, theBase>
  Permalink  
Comments
bartello at 22-May-11 15:42pm
   
Ok!! thanks a lot!! :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

wouldn't you go the other way?
 
class CTransparentBtn : public CMenuButtonImpl<ctransparentbtn,wtl::cbutton,ccontrolwintraits>
{
// ...
};
  Permalink  
Comments
bartello at 21-May-11 7:20am
   
thanks! but it's harder than u think. In this case I had to add some template arguments to class CTransparentBtn. I'd like to know the answer to MY question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 5,374
1 Sergey Alexandrovich Kryukov 4,713
2 Peter Leow 2,944
3 DamithSL 2,465
4 Maciej Los 2,270


Advertise | Privacy | Mobile
Web01 | 2.8.140718.1 | Last Updated 21 May 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid