Re: [UOPL-Architect] how design uopl gui applications
Status: Planning
Brought to you by:
bsstmiller
|
From: Richard B W. <rb...@us...> - 2004-12-13 19:52:50
|
When I tried to use this technique, the component compiled OK but I got an
access violation when I tried to install the component. This is what I
expected. I believe that this means if UOPL starts from anything below
TComponent, it will not be possible to place the UOPL components on the
component palette.
Here is what I did.
1. I copied a Classes into a new unit called MyClasses
2. In MyClasses, I changed the ancestor of TComponent from TPersistent to
TInterfacedPersistent.
3. I changed the declaration of QueryInterface to override the declaration
in TInterfacedPersistent.
before
function QueryInterface(const IID: TGUID; out Obj): HResult; virtual;
stdcall;
after
function QueryInterface(const IID: TGUID; out Obj): HResult; override;
stdcall;
4. I created a component in a new unit that used the version of TComponent
in MyClasses.
Here is a copy of that unit.
unit ExperimentUnit;
interface
uses Classes, MyClasses;
type
TExperimentComponent = class(TComponent)
private
FInt1: integer;
procedure SetInt1(const Value: integer);
published
property Int1: integer read FInt1 write SetInt1;
end;
procedure Register;
implementation
procedure Register;
begin
Classes.RegisterComponents('Experiments',
[Classes.TComponentClass(TExperimentComponent)]);
end;
{ TExperimentComponent }
procedure TExperimentComponent.SetInt1(const Value: integer);
begin
FInt1 := Value;
end;
end.
Richard B. Winston
rb...@us...
http://water.usgs.gov/nrp/gwsoftware/
703-648-5988
on Fridays: 301 474-2762
"Dennis Landi"
<de...@de...> To: <uop...@li...>
Sent by: cc:
uop...@li... Subject: Re: [UOPL-Architect] how design uopl gui applications
ceforge.net
12/03/2004 01:48 PM
Please respond to
uopl-architect
Re: the tInterfacedPersistent -->> tInterfacedComponent descendants being
registerable.
It will be interesting to see if a tInterfacedComponent replica of the
TComponent interface is registerable.
I don't see why it wouldn't be... It will be an easy enough experiment to
run.
You would simply have to typecast it in the Registration proc.
The registration syntax would be:
RegisterComponents('MyComponentPage',[tComponentClass(TMyComponent)]);
The interfaces of both artifacts would have to match; and if so, the IDE
registration mechanism probably won't notice.
This means that would have to hack the original source of tComponent; and
clone a tInterfaceComponent version; which we would probably have to only
be
able to distribute as a DCU... But, I don't see that as a show-stopper.
If the technique works, then we can actually introduce it to the delphi
community, as it will allow them to unify artificacts at the component
level, which will come in really handy for things like plug-ins.
Dennis Landi
Allied Data, Inc.
800 204 2722
http://www.dennislandi.com
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
UOPL-architect mailing list
UOP...@li...
https://lists.sourceforge.net/lists/listinfo/uopl-architect
|