Still havn't figured it out but getting closer.
Looked at TLabeledEdit & TSimpleDataSet and changed my code to the
following.
The SubComponent shows in the editor properties but still not on the events
side.
unit component1;
interface
uses
SysUtils, Classes, Forms, stdctrls;
type
TRowBeforePostEvent = procedure(Sender: TObject; var AAccepted: boolean)
of object;
TEditRow = class(TComponent)
private
FOnRowBeforePost: TRowBeforePostEvent;
FRowNumber: Integer;
protected
procedure DoRowBeforePost(var AAccepted: boolean); virtual;
published
property RowNumber: Integer Read FRowNumber Write FRowNumber;
property OnRowBeforePost: TRowBeforePostEvent read FOnRowBeforePost
write FOnRowBeforePost;
end;
TTest = class(TComponent)
private
FEditRow: TEditRow;
FTestCnt: Integer;
public
Constructor Create(AOwner: TComponent); override;
published
Property TestCnt: Integer read FTestCnt write FTestCnt;
property EditRow: TEditRow read FEditRow;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TTest]);
end;
{ TEditRow }
procedure TEditRow.DoRowBeforePost(var AAccepted: boolean);
begin
If Assigned(FOnRowBeforePost) then
FOnRowBeforePost(Self,AAccepted);
end;
{ TTest }
constructor TTest.Create(AOwner: TComponent);
begin
inherited; // Create(AOwner);
FEditRow := TEditRow.Create(Self);
FEditRow.Name := 'MyRow';
SetSubComponent(True);
end;
end.
--
Cheers
Glenn Shukster
Post by Glenn ShuksterHi
I still have not figured it out but wanted to send provice an example of a
component with this problem.
Now Even the EditRow RowNumber will not appear under properties.
Post by Glenn ShuksterHi
I have a main component called MyGrid. One of its properties is MyRow
object that inherits from TPersistent. In the property editor of the
grid I can see MyRow and all its properties when I click the plus sign.
Unfortunatly, I don't see MyRow on the events side with all its events.
The events are published.
Do I have to inherit from something else to allow users to be able to
get at MyRow events from MyGrid?
--
Thanks
Glenn Shukster