?
Solved

Streaming Published Properties

Posted on 2002-06-29
2
Medium Priority
?
216 Views
Last Modified: 2010-04-04
I'm experimenting with saving and loading components using Delphi's streaming mechanism. I've declared a new class with the following declaration :

TOmxSourceID   = type integer;
TOmxClassID    = type integer;

TOmxSourceClass = class(TPersistent)
private
  FClass: TOmxClassID;
  FSource: TOmxSourceID;
published
  property Source : TOmxSourceID read FSource write FSource;
  property SourceClass : TOmxClassID read FClass write FClass;
end;

I have then declared a new panel component with TomxSourceClass as a published property

TOmxDataEntryPanel = class(TPanel)
private
  FSourceClass: TOmxSourceClass;
public
  constructor Create(AOwner : TComponent); override;
published
  property SourceClass : TOmxSourceClass read FSourceClass;
end;

constructor TOmxDataEntryPanel.Create(AOwner: TComponent);
begin
  inherited;
  FSourceClass := TOmxSourceClass.Create;
  FSourceClass.Source := -1;
  FSourceClass.SourceClass  := -1;
end;

The SourceClass.Source and SourceClass.SourceClass properties can be set OK but when the form is saved to a database and reloaded the properties have defaulted back to -1. I don't think the problem is with the save/load routines as all the other properties are saved ok.

Could it be the declarations of TomxSourceID and TomxClassID?

Thanks

Jo
0
Comment
Question by:nnbbb09
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Author Comment

by:nnbbb09
ID: 7120369

I've managed to answer it myself. The problem was due to SourceClass being declared as a readonly property of TomxPanel. It should read

TOmxDataEntryPanel = class(TPanel)
private
 FSourceClass: TOmxSourceClass;
public
 constructor Create(AOwner : TComponent); override;
published
 property SourceClass : TOmxSourceClass read FSourceClass write FSourceClass;
end;
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7120627
Points refunded and question closed, per Asker request.

Netminder
CS Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question