soapsiam
asked on
What wrong with this (Subproperty with TPersistent)?
I want to define property Range on my component with 2 subproperty; StartRange and EndRange, thus I defined it using the TPersistent descendant.....
unit MyUnit;
interface
uses
Windows, Messages, SysUtils, Classes, WinInet;
TpgHttpRange = class(TPersistent)
private
FStartRange: integer;
FEndRange: integer;
public
procedure Assign(Source: TPersistent); override;
published
property StartRange : integer read FStartRange write FStartRange default 0;
property EndRange : integer read FEndRange write FEndRange default 0;
end;
TpgHttpDownLoad = class(TComponent)
private
//---others----....
FRange : TpgHttpRange;
// ---others-----
published
property Range: TpgHttpRange read FRange write
FRange;
//------others-----
end;
Implementation
procedure TpgHTTPRange.Assign(Source : TPersistent);
begin
if Source is TpgHttpRange then
with Source as TpgHttpRange do
begin
StartRange := Self.FStartRange;
EndRange := Self.FEndRange;
end
else
inherited Assign(Source);
end;
//---others------
end.
After registering, on object inspector when I click on
[+] before the Range (which it should expanded and dislayed subproperties), the exception 'Unable to expand'
was shown. What wrong with this implementation.....
unit MyUnit;
interface
uses
Windows, Messages, SysUtils, Classes, WinInet;
TpgHttpRange = class(TPersistent)
private
FStartRange: integer;
FEndRange: integer;
public
procedure Assign(Source: TPersistent); override;
published
property StartRange : integer read FStartRange write FStartRange default 0;
property EndRange : integer read FEndRange write FEndRange default 0;
end;
TpgHttpDownLoad = class(TComponent)
private
//---others----....
FRange : TpgHttpRange;
// ---others-----
published
property Range: TpgHttpRange read FRange write
FRange;
//------others-----
end;
Implementation
procedure TpgHTTPRange.Assign(Source
begin
if Source is TpgHttpRange then
with Source as TpgHttpRange do
begin
StartRange := Self.FStartRange;
EndRange := Self.FEndRange;
end
else
inherited Assign(Source);
end;
//---others------
end.
After registering, on object inspector when I click on
[+] before the Range (which it should expanded and dislayed subproperties), the exception 'Unable to expand'
was shown. What wrong with this implementation.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)) this happens sometimes to me too,
just forgot something and the searching, searching, ...
well, glad to helped you,
thanks for the points :-)
good luck again
meikl ;-)
just forgot something and the searching, searching, ...
well, glad to helped you,
thanks for the points :-)
good luck again
meikl ;-)
ASKER
Thanks, soap