Board index » delphi » Setting fields in records of Delphi server

Setting fields in records of Delphi server

I have a Tiny Delphi COM Server (D5Server).  In the Type Library I have
defined one COM Record called D5Record.  I have defined one property of type
D5Record that has a get/set method that stores/retrieves one instance of the
D5record from the private section.

I can successfully get the values in VB, such as:

  Msgbox D5Server.Myprop.D5Field1

But when I do code such as the following:

  D5Server.Myprop.D5Field = 1 (in VB)

the value is not set and no code is actually called in my set method for the
property.

I cannot assign an instance of D5record to the property, VB complains it
can't use a ByRef value.

If I try to assign in a Delphi client as follows:

 D5Server.Myprop.D5Field := 1; (Delphi)

The compiler says "Left side cannot be assigned to".

Is there a simple solution or must I do what I have done in the past as
define D5Record as a automation object?

Paul

 

Re:Setting fields in records of Delphi server


This is a design issue and cannot be solved using your design. The same
problem is true in a non-COM interface (for instance, a native Delphi class
property that is a record structure will contain fields that cannot be
semantically assigned to).

One solution is to convert the property to a method access where in the
record can be passed in as a parameter to the method to send in the record's
values. Or, like you suspected you can create a hierarchy design for this.

--
have fun
Binh Ly
www.techvanguards.com

Quote
"Paul Bartlett" <paul_bartl...@yahoo.com> wrote in message

news:3b225c42_2@dnews...
Quote
> I have a Tiny Delphi COM Server (D5Server).  In the Type Library I have
> defined one COM Record called D5Record.  I have defined one property of
type
> D5Record that has a get/set method that stores/retrieves one instance of
the
> D5record from the private section.

> I can successfully get the values in VB, such as:

>   Msgbox D5Server.Myprop.D5Field1

> But when I do code such as the following:

>   D5Server.Myprop.D5Field = 1 (in VB)

Other Threads