View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004615 | JEDI VCL | 00 JVCL Components | public | 2008-12-09 21:08 | 2008-12-22 04:17 |
Reporter | Steve009a | Assigned To | obones | ||
Priority | normal | Severity | trivial | Reproducibility | have not tried |
Status | resolved | Resolution | no change required | ||
Product Version | 3.35 | ||||
Target Version | Fixed in Version | ||||
Summary | 0004615: Runtime Assignment of DataConnector.DataSource | ||||
Description | I need to make the following assignment in c++ code (BCB6): JvValidateEdit1->DataConnector->DataSource = JvDataSource1; ...compiler gives the error: E2034 Cannot convert 'TJvDataSource *' to '_di_IJvDataSource' Having tried various casts and tried the Assign function without success, What would the correct syntax be? Apologies if this isn't the correct area to ask this type of question. Thanks for your help. | ||||
Tags | No tags attached. | ||||
|
You need to query the interface, like this: IJvDataSource* Tmp; JvDataSource1->QueryInterface(__uuidof(IJvDataSource), (void**)&Tmp); JvValidateEdit1->DataConnector->DataSource = Tmp; You should even check the result of QueryInterface to be sure you actually received a valid interface in Tmp. Let me know if this helps. |
|
Thanks for your reply, now I understand about querying the interface. But the compiling the following code... IJvDataSource* Tmp; dm->JvDataSource1->QueryInterface(__uuidof(IJvDataSource), (void**)&Tmp); if(Tmp) JvValidateEdit1->DataConnector->DataSource = Tmp; Gives the compile error: [C++ Error] Config.cpp(389): E2247 '__stdcall TComponent::QueryInterface(const _GUID &,void *)' is not accessible |
|
Maybe you could try using SysUtils::Supports method then. Something like this: IJvDataSource Tmp; if (Supports(dm->JvDataSource1, __uuidof(IJvDataSource), &Tmp)) JvValidateEdit1->DataConnector->DataSource = Tmp; If that does not work, there is the possibility to call GetInterface as well, something like that: IJvDataSource Tmp; if (dm->JvDataSource1->GetInterface(Tmp)) JvValidateEdit1->DataConnector->DataSource = Tmp; It's always more complicated with C++ Builder, but one of these methods work. |
|
Both the methods you suggested worked. Thank you, the issue is resolved. |
|
No worries, thanks for letting us know. |
Date Modified | Username | Field | Change |
---|---|---|---|
2008-12-09 21:08 | Steve009a | New Issue | |
2008-12-10 07:53 | obones | Note Added: 0015086 | |
2008-12-10 07:53 | obones | Status | new => feedback |
2008-12-10 17:31 | Steve009a | Note Added: 0015092 | |
2008-12-18 01:02 | obones | Note Added: 0015107 | |
2008-12-20 18:19 | Steve009a | Note Added: 0015119 | |
2008-12-22 04:17 | obones | Note Added: 0015126 | |
2008-12-22 04:17 | obones | Status | feedback => resolved |
2008-12-22 04:17 | obones | Resolution | open => no change required |
2008-12-22 04:17 | obones | Assigned To | => obones |