Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Carlos
Mon, 21 Jan 2008 19:44
Supports function
Author: Carlos
Date: Mon, 21 Jan 2008 19:44
Date: Mon, 21 Jan 2008 19:44
16 lines
1312 bytes
1312 bytes
Hello,
I am trying to use Supports function of SysUtils. But I don�t know how
TWinControl * pAC = Screen->ActiveControl;
if ( pAC )
{
TcxCustomEdit * pCE = NULL;
if ( Supports(pAC, _di_IcxInnerEditHelper) || Supports(pAC,
_di_IcxContainerInnerControl) )
pCE = (TcxCustomEdit *)pAC->Owner;
Which is the correction ?
Thank you
Re: Supports function
Author: Remy Lebeau (TeamB)
Date: Tue, 22 Jan 2008 19:30
Date: Tue, 22 Jan 2008 19:30
42 lines
2019 bytes
2019 bytes
"Carlos" <a@a.com> wrote in message
news:4794f632$1@newsgroups.borland.com...
> I am trying to use Supports function of SysUtils. But I don�t know how
You are passing the interface types the wrong way. Do not use the '_di_...'
typedefs. You need to use the interface IIDs instead, ie:
TWinControl *pAC = Screen->ActiveControl;
if( pAC )
{
TcxCustomEdit *pCE = NULL;
if( Supports(pAC, IID_IcxInnerEditHelper) || Supports(pAC,
IID_IcxContainerInnerControl) )
pCE = (TcxCustomEdit*) pAC->Owner;
//...
}
Or:
TWinControl *pAC = Screen->ActiveControl;
if( pAC )
{
TcxCustomEdit *pCE = NULL;
if( Supports(pAC, __uuidof(IcxInnerEditHelper)) || Supports(pAC,
__uuidof(IcxContainerInnerControl)) )
pCE = (TcxCustomEdit*) pAC->Owner;
//...
}
Or, you could simply use dynamic_cast and ignore Supports() altogether:
TWinControl * pAC = Screen->ActiveControl;
if( pAC )
{
TcxCustomEdit *pCE = dynamic_cast<TcxCustomEdit*>(pAC->Owner);
//...
}
Gambit
Re: Supports function
Author: Carlos
Date: Mon, 28 Jan 2008 13:28
Date: Mon, 28 Jan 2008 13:28
1 lines
1045 bytes
1045 bytes
Thank you
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads