[lazarus] CVS updated
Marc Weustink
Marc.Weustink at cuperus.nl
Mon Jun 26 04:42:59 EDT 2000
+ From: Shane Miller [mailto:SMiller1 at stvgb.org]
+ Sent: Thursday, 22 June, 2000 15:41
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Your messages have a bit of delay :)
+ I agree we need the flexibility that Delphi has when adding
+ controls to the IDE.
+ However I think this still gives us that ability.
+ We would simply call a function in another unit that people
+ can add their controls to (like a package in Delphi).
+ The function would return a list of all the controls and
+ their page and any other info we need and then the IDE could
+ add them.
+ Each of the controls would have their own onclick,
+ ondblclick, etc functions in the compiled package file and
+ therefore it would remain very flexible.
OnClick and OnDblClick arent the only events that need to be implemented.
How do you want to add support for all other events. I think you can require
that for every component a wrapper is written for all events. Besides that
how do we onvoke them ? Most if not all the info we need is already supplied
by the RTTI.
+ I am not against changing it if you explain a bit better how
+ people would add their controls and such...
Like delphi does:
procedure RegisterComponents(
const Page: string;
ComponentClasses: array of TComponentClass;
Images: array of TGraphic
);
We only have to add an image since we cant get them from a resource.
Register components puts the components in a collection which keeps the
info. (A collection of TIDEComponent)
TIDEComponent = class(TCollectionItem)
FPage: string;
FComponentClass: TComponentClass;
FImage: TGraphic;
end;
Based upon this collection the component pages are created. When a component
is selected from the palette
FCurrentComponentClass := TIDEComponents[Speedbutton.Tag].ComponentClass
you can create it through
NewComponent := FCurrentComponentClass.Create(FCurrentDesignForm);
The OnClick is handled by the IDE to set the FCurrentComponent. Also the
FCurrentDesignForm (or its Selection) and FObjectInspector is notified that
it is changed.
The OnDblClick is handled by the IDE and the Default event (=method)
PropertyEditor. It creates the default event (most of the time OnClick but
if not available then the first event) if needed and jumps to the
CodeEditor.
The info needed we get from the RTTI throug GetPropInfo, GetPropInfos,
GetPropList. These are provieded through implementations/instances of
TPropertyEditor.
PropertyEditors are registered through
procedure RegisterPropertyEditor(
PropertyType: PTypeInfo;
ComponentClass: TClass;
const PropertyName: string;
EditorClass: TPropertyEditorClass
);
If we want to find an Event we are looking for a TMethodPRoperty. This class
implements the Edit method and makes the calls to create the editor lines
and the jump to it.
This way you have a general registration of Components. In theory, the IDE
has nothing to know about them exept that they are derived from TComponent.
Second, you have a general way to edit properties, without knowledge of the
class you edit.
Marc
More information about the Lazarus
mailing list