Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-09

Object Inspector reuse ?

12 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

Can the IDE's object inspector be used independent of the IDE ?

I need to create a report designer, and it would save me a lot of work if I could re-use the IDE's object inspector. So before I dive in the code, I thought I'd ask here first. Maybe someone has already attempted such a thing.

As an alternative: can the RTTI property grid be used on a list of objects ? Last time I worked with it, it could only handle 1 object at a time.

Michael.

Reply by email

Giuliano Colla
to Michael Van Canneyt

If I remember well, Lazreport does something of this sort. Worth giving a look. Giuliano

Inviato da iPhone

Show quoted text 22 lines
Il giorno 07 set 2016, alle ore 22:23, Michael Van Canneyt ha scritto: Hi, Can the IDE's object inspector be used independent of the IDE ? I need to create a report designer, and it would save me a lot of work if I could re-use the IDE's object inspector. So before I dive in the code, I thought I'd ask here first. Maybe someone has already attempted such a thing. As an alternative: can the RTTI property grid be used on a list of objects ? Last time I worked with it, it could only handle 1 object at a time. Michael. -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

Reply by email

Michael Van Canneyt
to Giuliano Colla
Giuliano Colla wrote
If I remember well, Lazreport does something of this sort. Worth giving a look. Giuliano

Indeed.

I had a look...

I copy here the uses section of the Object Inspector unit:

  // IMPORTANT: the object inspector is a tool and can be used in other programs
  //            too. Don't put Lazarus IDE specific things here.

If you look at the above 'Important' warning and then look below:

   // RTL / FCL
   SysUtils, Types, Classes, TypInfo, math, FPCanvas,
   // LCL
   InterfaceBase, LCLType, LCLIntf, Forms, Buttons, Graphics, GraphType,

StdCtrls,
Controls, ComCtrls, ExtCtrls, Menus, Dialogs, Themes, LMessages, LCLProc,

   // LazControls
   {$IFnDEF UseOINormalCheckBox} CheckBoxThemed, {$ENDIF}
   TreeFilterEdit, ListFilterEdit,
   // LazUtils
   LazConfigStorage, LazLoggerBase,
   // IdeIntf
   IDEImagesIntf, IDEHelpIntf, ObjInspStrConsts,
   PropEdits, PropEditUtils, ComponentTreeView, OIFavoriteProperties,
   ListViewPropEdit, ImageListEditor, ComponentEditors, ChangeParentDlg;

Everything below "IdeIntf" seems quite "Lazarus IDE specific" to me. So the 'Important' warning can be removed, it is useless.

So using the object inspector is already out.
Well, I got an answer to my question :-)

Michael.

Show quoted text 18 lines
Inviato da iPhone > Il giorno 07 set 2016, alle ore 22:23, Michael Van Canneyt ha scritto: > > > > Hi, > > Can the IDE's object inspector be used independent of the IDE ? > > I need to create a report designer, and it would save me a lot of work if I > could re-use the IDE's object inspector. So before I dive in the code, I > thought I'd ask here first. Maybe someone has already attempted such a > thing. > > As an alternative: can the RTTI property grid be used on a list of objects ? > Last time I worked with it, it could only handle 1 object at a time.
Show quoted text 13 lines
> > Michael. > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus-ide.org/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus-ide.org/listinfo/lazarus

Reply by email

Mattias Gaertner
to Michael Van Canneyt: Indeed. I had a look... I copy here the uses section of the Object Inspector unit: //…
Show quoted text 15 lines
[...] // IMPORTANT: the object inspector is a tool and can be used in other programs // too. Don't put Lazarus IDE specific things here. If you look at the above 'Important' warning and then look below: [...] // IdeIntf IDEImagesIntf, IDEHelpIntf, ObjInspStrConsts, PropEdits, PropEditUtils, ComponentTreeView, OIFavoriteProperties, ListViewPropEdit, ImageListEditor, ComponentEditors, ChangeParentDlg; Everything below "IdeIntf" seems quite "Lazarus IDE specific" to me. So the 'Important' warning can be removed, it is useless.

These are property editors for the FCL/LCL types and the component tree view.
They are LCL specific, not IDE specific.

If you don't need the LCL editors, it should be easy to add some IFDEFs.

So using the object inspector is already out. Well, I got an answer to my question :-)

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 21 lines
On Thu, 8 Sep 2016 08:04:18 +0200 (CEST) Michael Van Canneyt wrote: > [...] > // IMPORTANT: the object inspector is a tool and can be used in other programs > // too. Don't put Lazarus IDE specific things here. > > If you look at the above 'Important' warning and then look below: > > [...] > // IdeIntf > IDEImagesIntf, IDEHelpIntf, ObjInspStrConsts, > PropEdits, PropEditUtils, ComponentTreeView, OIFavoriteProperties, > ListViewPropEdit, ImageListEditor, ComponentEditors, ChangeParentDlg; > > > Everything below "IdeIntf" seems quite "Lazarus IDE specific" to me. > So the 'Important' warning can be removed, it is useless. These are property editors for the FCL/LCL types and the component tree view. They are LCL specific, not IDE specific.

I beg to differ somwhat....
A quick glance reveals that they reference for example the help system of the IDE. IDEWindowIntf is also not really something I want in my end-user binary. I can probably find more..

If you don't need the LCL editors, it should be easy to add some IFDEFs.

That will create a serious mess, because for my project I would need to enable the define, and when compiling the IDE the define must be disabled etc.

IMHO Better is to have a TBaseObjectInspector/TIDEObjectInspector approach: a base class that can be used without all (or most of) the IDEIntf stuff, and a descendent that uses the IDE stuff to provide additional functionality.

As far as I can see, the only needed thing is the PropEdits unit, since that is what is needed to enable property editors.

Michael.

Reply by email

Mattias Gaertner
to Michael Van Canneyt
Show quoted text 6 lines
[...] > These are property editors for the FCL/LCL types and the component tree > view. They are LCL specific, not IDE specific. I beg to differ somwhat.... A quick glance reveals that they reference for example the help system of the IDE.

It uses the hint window.
You can use this to show your own hints in your application.

IDEWindowIntf is also not really something I want in my end-user binary.

IDEWindowIntf?

Show quoted text 7 lines
I can probably find more.. > If you don't need the LCL editors, it should be easy to add some IFDEFs. That will create a serious mess, because for my project I would need to enable the define, and when compiling the IDE the define must be disabled etc.

A project can add defines to its packages. These will not be used when compiling the IDE.
See here:
http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Add_a_flag_to_one_package_without_altering_the_lpk_itself

Show quoted text 6 lines
IMHO Better is to have a TBaseObjectInspector/TIDEObjectInspector approach: a base class that can be used without all (or most of) the IDEIntf stuff, and a descendent that uses the IDE stuff to provide additional functionality. As far as I can see, the only needed thing is the PropEdits unit, since that is what is needed to enable property editors.

Feel free to create a patch.
The name TObjectInspectorDlg should be changed anyway. "Dlg" is used in the Lazarus sources for modal windows.
TBaseObjectInspector/TIDEObjectInspector is good.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner: On Thu, 8 Sep 2016 09:13:49 +0200 (CEST) It uses the hint window. You can use this to…
Mattias Gaertner wrote 12 lines
On Thu, 8 Sep 2016 09:13:49 +0200 (CEST) Michael Van Canneyt wrote: > [...] > > These are property editors for the FCL/LCL types and the component tree > > view. They are LCL specific, not IDE specific. > > I beg to differ somwhat.... > A quick glance reveals that they reference for example the help system of the IDE. It uses the hint window. You can use this to show your own hints in your application.

I suppose you know that the IDEHelpIntf contains a whole lot more than just that ?

Show quoted text 7 lines
> IDEWindowIntf is also not really something I want in my end-user binary. IDEWindowIntf? From PropEdits:
   // Forms with .lfm files
   FrmSelectProps, StringsPropEditDlg, KeyValPropEditDlg, CollectionPropEditForm,
   FileFilterPropEditor, IDEWindowIntf;
From my point of view, none of these should appear in propedits.

Some are probably for Delphi compatibility.

I can see that an effort was made to make the OI independent of the IDE, but it is either not sufficient, or it has been watered down over time. In each case, it pulls in way more than I consider appropriate. (from an IDE point of view, the tight integration makes sense, no discussion there)

So it seems that either I take the whole shebang, or I must roll my own.

Michael.

Reply by email

Michael Van Canneyt
to Mattias Gaertner: On Wed, 7 Sep 2016 22:23:04 +0200 (CEST) It should be able to handle lists of…
Mattias Gaertner wrote 11 lines
On Wed, 7 Sep 2016 22:23:04 +0200 (CEST) Michael Van Canneyt wrote: > [...] > As an alternative: can the RTTI property grid be used on a list of objects ? > Last time I worked with it, it could only handle 1 object at a time. It should be able to handle lists of persistents, because it is the full OI grid. Set the TIObject to the lookup root. Then set the Selection.

OK, I think that will be a better approach for what I have in mind, thanks !

Michael.

Reply by email

Mattias Gaertner
to Michael Van Canneyt: I suppose you know that the IDEHelpIntf contains a whole lot more than just that ? //…
Show quoted text 16 lines
On Thu, 8 Sep 2016, Mattias Gaertner wrote: > On Thu, 8 Sep 2016 09:13:49 +0200 (CEST) > Michael Van Canneyt wrote: > >> [...] >> > These are property editors for the FCL/LCL types and the component tree >> > view. They are LCL specific, not IDE specific. >> >> I beg to differ somwhat.... >> A quick glance reveals that they reference for example the help system of the IDE. > > It uses the hint window. > You can use this to show your own hints in your application. I suppose you know that the IDEHelpIntf contains a whole lot more than just that ?

Yes. Although no initialization sections.

Show quoted text 9 lines
>> IDEWindowIntf is also not really something I want in my end-user binary. > > IDEWindowIntf? From PropEdits: // Forms with .lfm files FrmSelectProps, StringsPropEditDlg, KeyValPropEditDlg, CollectionPropEditForm, FileFilterPropEditor, IDEWindowIntf;

For one call:

  SetPopupModeParentForPropertyEditor(CollectionForm);

I'm not sure why this is needed.

Show quoted text 5 lines
From my point of view, none of these should appear in propedits. Some are probably for Delphi compatibility. I can see that an effort was made to make the OI independent of the IDE, but it is either not sufficient, or it has been watered down over time.

The later.

Show quoted text 5 lines
In each case, it pulls in way more than I consider appropriate. (from an IDE point of view, the tight integration makes sense, no discussion there) So it seems that either I take the whole shebang, or I must roll my own.

Well, a TBaseObjectInspector could reduce the shebang.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 6 lines
> > It uses the hint window. > > You can use this to show your own hints in your application. > > I suppose you know that the IDEHelpIntf contains a whole lot more than just that ? Yes. Although no initialization sections.

Luckily, but I don't want all this code in my binary :-)

Show quoted text 13 lines
> >> IDEWindowIntf is also not really something I want in my end-user binary. > > > > IDEWindowIntf? > > From PropEdits: > > // Forms with .lfm files > FrmSelectProps, StringsPropEditDlg, KeyValPropEditDlg, CollectionPropEditForm, > FileFilterPropEditor, IDEWindowIntf; For one call: SetPopupModeParentForPropertyEditor(CollectionForm); I'm not sure why this is needed.

If you don't know, I certainly do not know... :/

Show quoted text 17 lines
> From my point of view, none of these should appear in propedits. > Some are probably for Delphi compatibility. > > I can see that an effort was made to make the OI independent of the IDE, > but it is either not sufficient, or it has been watered down over time. The later. > In each case, it pulls in way more than I consider appropriate. > (from an IDE point of view, the tight integration makes sense, no discussion > there) > > So it seems that either I take the whole shebang, or I must roll my own. Well, a TBaseObjectInspector could reduce the shebang.

When I start my implementation, I will consider it. The OI is quite powerful, it would be a shame not to be able to use it.

Michael.

Reply by email