Solved

Call DEFINE_RESPONSE_TABLEx 4 templates

Posted on 1997-12-24
3
370 Views
Last Modified: 2013-12-26
How 2 call DEFINE_RESPONSE_TABLEx 4 templates ?

I want 2 build a template 4  Dialog witch can be called
as normal 'TDialog' or as 'TOleDialog' so this can be done :

*******************************************
TMyDialog::TMyDialog(TWindow * AParent)
         : TDlgBase<TDialog>

==> TMyDialog acts like 'TDialog'

TMyDialog::TMyDialog(TWindow * AParent)
         : TDlgBase<TOleDialog>

==> TMyDialog acts like 'TOleDialog'
*******************************************

I have done all the code but now I don´t know how to
call the DEFINE_RESPONSE_TABLEx, DECLARE_RESPONSE_TABLE Makros ?


*******************************************
Examlpe Header :

template <class TDlg> class TDlgBase
                 : public TDlg
{
public:

         THelpDlgBase(TWindow *AParent);

protected:

         void                 EvNCPaint();

DECLARE_RESPONSE_TABLE( TDlgBase ); /*????*/
};
********************************************

********************************************
Examlpe Cpp :

template <class TDlg>
TDlgBase<TDlg>::TDlgBase(TWindow * AParent)
              : TDlg(AParent)
{
}

template <class TDlg> inline void
THelpDlgBase<TDlg>::EvNCPaint()
{
  TDlg::EvNCPaint();
 
}

DEFINE_RESPONSE_TABLE1( THelpDlgBase , TDlg )  /*?????*/
   EV_WM_NCPAINT,
END_RESPONSE_TABLE;

********************************************
0
Comment
Question by:Dirk_Sander
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
JPM earned 20 total points
ID: 1299503
This works for me!

template <class T> class TmyTemplateDlg : public TDialog
{.....................}

class TmyDialog : public TmyTemplateDlg< myDataClass >
{
......................
DECLARE_RESPONSE_TABLE( TmyDialog )

}
................
DEFINE_RESPONSE_TABLE1( TmyDialog , TDialog )
........

myDataClass is a class I have defined to storing data associated to TmyDialog box


( NB :  When it's only a comment , the current balance doesn't change , does it???
  So don't care about !
  Many guys can answer for free..... and I guess I can ! )        .... kidding.....

0
 
LVL 3

Expert Comment

by:LucHoltkamp
ID: 1299504
I don't think that answers Dirk_Sanders' question, he wants a template which takes a TWindow derived as parameter and this gives a lot of trouble with owl's DEFINE_RESPONSE_TABLE macro.
However, I think I have a (reusable) answer, requiring a few lines (8) of "code". Hint: take a look at owl/eventhan.h
.luc.
0
 

Author Comment

by:Dirk_Sander
ID: 1299505
What luc said is right !

I want to use TDialog or TOleDialog as base class
but in TMyDialog there has to be the DEFINE_RESPONSE_TABLE macro !

But here is the solution :

In Header file all as usual :

************************************
DECLARE_RESPONSE_TABLE( TMyDialog );
************************************

In Cpp file a little workarround 4 the makro :

*************************************************************
template <class TDlgBase> inline bool
TMyDialog<TDlgBase>::Find(TEventInfo& eventInfo, TEqualOperator equal)
{
  eventInfo.Object = (GENERIC*)this;

  return SearchEntries((TGenericTableEntry __RTFAR*)__entries,  eventInfo, equal) ||
         TDlgBase::Find(eventInfo, equal);
}

template <class TDlgBase> inline TResponseTableEntry<TMyDialog<TDlgBase> >
 __RTFAR  TMyDialog<TDlgBase>::__entries[] =
{
   EV_WM_NCPAINT,
   EV_WM_ACTIVATE,
   EV_WM_INITMENU,
   EV_WM_PAINT,
   EV_WM_SYSCOMMAND,
END_RESPONSE_TABLE;

***************************************************************
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question