Solved

Streaming Published Properties

Posted on 2002-06-29
2
213 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

717 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