Board index » cppbuilder » Why?

Why?


2003-07-09 01:08:16 AM
cppbuilder45
Why can I use a data module in a plain unit file? I used an include to
access the querys inside the module, but the compiler can see them. If I use
a unit with a form attached the include statement works. Builder's IDE
allows to include the data module to a form (File/Include unit hdr...), this
option is not avilable with a unit file, so there is a difference somewhere.
How can I use a data module with my unit?
 
 

Re:Why?

"Gonzalo Nieva" < XXXX@XXXXX.COM >wrote:
Quote
Why can I use a data module in a plain unit file? I used an
include to access the querys inside the module, but the
compiler can see them.
I assume that you ment that the compiler can NOT see them. If
you want to access members or methods of an other unit, in the
header where the members to be accessed are declared, you need
to make them public:
//-------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
// Everything in this section is private to the unit
public: // User declarations
// Everything in this section is public
// to access MyQuerry from another unit include this
// header in that unit and use Form1->MyQuerry();
void __fastcall MyQuerry();
__fastcall TForm1(TComponent* Owner);
};
//-------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//-------------------------------------------------------------
~ JD
 

Re:Why?

I think You are in the right track, those querys are declared _published:.
Is it safe to chage them to public:?
Thanks for your help.
 

{smallsort}

Re:Why?

"Gonzalo Nieva" < XXXX@XXXXX.COM >wrote:
Quote
I think You are in the right track, those querys are declared _published:.
Is it safe to chage them to public:?
No. You don't touch stuff in that section. It'a all managed by
the IDE.
The solution is simple:
//----- in the header ---------
class TForm1 : public TForm
{
__published: // IDE-managed Components
void __fastcall QuerryTheDataClick(TObject *Sender);
private: // User declarations
public: // User declarations
void __fastcall MyQuerry();
__fastcall TForm1(TComponent* Owner);
};
//------------------------------
//------ in the unit -----------
void __fastcall TForm1::QuerryTheDataClick(TObject *Sender)
{
MyQuerry();
}
//-----------------
void __fastcall TForm1::MyQuerry()
{
// code for the actuall querry
}
//-----------------
Now you can access it using Form1->MyQuerry();
~ JD
 

Re:Why?

I just remembered something I saw in the manual: All I have to do is to use
the form's variable to reach the published components!. Thanks for your
help.
 

Re:Why?

Mike
I try your code but in the following line:
objCDO := CreateOLEObject('MAPI.Session');
I receive the eeror message (EolesysError 'String of class not valid')
also in
objMsg := objCDO.GetMessage(itemOL.EntryID, itemOL.Parent.StoreID);
I cant find the property StoreId of the MailItem.Parent object
--- posted by geoForum on delphi.newswhat.com
 

Re:Why?

Reinstall your Outlook
 

Re:Why?

I am troubled with problem,
program prog;
uses Unit2;
const a=c;
....
unit unit2
interface
uses unit1
....
unit unit1
interface
const c=1
....
compiler show error:Undeclared identifier:'c'
why?Do delphi support this ?
 

Re:Why?

On 17 Feb 2004, "weiwi" < XXXX@XXXXX.COM >wrote:
Quote
program prog;
uses Unit2;
const a=c;
....
unit unit2
interface
uses unit1
....
unit unit1
interface
const c=1
....

compiler show error:Undeclared identifier:'c'

why?Do delphi support this ?
Just because the program uses unit2 doesn't make everything in unit1
visible to the main program. You'd have to add unit1 to the program uses
clause to achieve that.
--
-Mike (TeamB)
 

Re:Why?

weiwi wrote:
Quote
I am troubled with problem,

program prog;
uses Unit2;
const a=c;
....
unit unit2
interface
uses unit1
....
unit unit1
interface
const c=1
....

compiler show error:Undeclared identifier:'c'

why?Do delphi support this ?
Add Unit1 in the Uses of program prog and it will work.
 

Re:Why?

thanks, Mike and Aniket.
"weiwi" < XXXX@XXXXX.COM >дʼ news:40323e41$ XXXX@XXXXX.COM ...
Quote
I am troubled with problem,

program prog;
uses Unit2;
const a=c;
....
unit unit2
interface
uses unit1
....
unit unit1
interface
const c=1
....

compiler show error:Undeclared identifier:'c'

why?Do delphi support this ?



 

Re:Why?

"weiwi" < XXXX@XXXXX.COM >wrote
Quote
I am troubled with problem,
It would help to get help with future "why"s if
you would put the subject of the problem in the
subject line of the post. Regards, JohnH
 

Re:Why?

I Use SQL Server. And I have compared BDE with ADO. But I feel, Quicker BDE
than ADO when loading data. Though most people telling nicer ADO. Can You
explain about it? Do I wrong to set at ADO's properties? or What?
 

Re:Why?

Adi,
ADO speed tips...
bdn.borland.com/article/0,1410,27790,00.html
Avoid using the BDE against MSSQL 7/2000 because...
community.borland.com/article/0,1410,28688,00.html
community.borland.com/article/0,1410,10359,00.html
community.borland.com/article/0,1410,19694,00.html
support.microsoft.com/default.aspx
If your coming from a desktop db background, check out...
bdn.borland.com/article/0,1410,28160,00.html
www.logicfundamentals.com/pages/BrowsingLargeTables.aspx
www.logicfundamentals.com/pages/TablesVsQueries.aspx
Some good db design advice...
www.hower.org/Kudzu/Articles/DBDesign/index.html
Good luck,
krf
"Bpk. Adi Wira Kusuma" < XXXX@XXXXX.COM >wrote in message
Quote
I Use SQL Server. And I have compared BDE with ADO. But I feel, Quicker
BDE
than ADO when loading data. Though most people telling nicer ADO. Can You
explain about it? Do I wrong to set at ADO's properties? or What?


 

Re:Why?

Cuz.
--
Mart
I'm soundtracking my life
To email me, remove clothes
--
borland.public.off-topic exists as a runoff for unwanted posts in the
technical groups. Enforcement of rules is deliberately minimal but
Borland reserves the right to cancel posts at any time, for any
reason, without notice.