-
Composite Controls
Hello,
I'm trying to write a wrapper class for a grid, and planning to do it with Composite Controls. I found the article "Composite Control Fundamentals" in MSDN which helped me to do this, and to trap events from the contained control in my wrapper control. But this article does not talk about how to call methods of the contained control from the CONTAINING control.
An example would be if the wrapper is called WRAPPERActiveX and contained activeX is called CONTAINEDActiveX, how do I call the method FOO_ContainedActiveX of the CONTAINEDActiveX control from WRAPPERActiveX Control.
Any help is appreciated.
-
Re: Composite Controls
Hi.
In order to catch ActiveX control in Composite control,
you need this kind of code.
VOID __stdcall OnClick()
{
// TODO : Add Code for event handler.
MessageBox("Control", "Test");
USES_CONVERSION;
CComPtr<ICalendar> pDFS;
HRESULT hr = GetDlgControl (
IDC_CALENDAR, IID_ICalendar, reinterpret_cast<void**>(&pDFS));
.............}
This is a code that when I click the grid on Calendar control on Composite control, program shows the date.
Hope for help.
-Masaaki Onishi-
-
Re: Composite Controls
Thanks for your reply. I do not know how to get the Interface IDs for the grid I'm working with. Is there a way that I can find it out from the .tlb file?
Thanks once again for any info.
-
Re: Composite Controls
Hi.
I was working this a couple months ago.
I must review this topic, but I don't have much time to do this for you.
VOID __stdcall OnClick()
{
// TODO : Add Code for event handler
CComPtr<ICalendar> pDFS;
//CComPtr<whatever> pDFS;
HRESULT hr = GetDlgControl (
IDC_CALENDAR, IID_ICalendar, reinterpret_cast<void**>(&pDFS));
/*HRESULT hr = GetDlgControl (
your Control ID, IID_whatever, reinterpret_cast<void**>(&pDFS));*/
pDFS->func on ActiveX control
..........
}
And when you add ActiveX control on composite control, you must
use "Insert ActiveX control " on menu showed by clicking right mouse
button on class view.
After this, VC autoamtically generates the code needed.
But the code above is your job.
Regards.
-Masaaki Onishi-