[Lazarus] Extending the IDE to edit icons/images from inside Lazarus

taazz taz at evosi.eu
Thu Mar 19 05:44:20 CET 2015


On 19/01/2015 00:01 πμ, Kostas Michalopoulos wrote:
> Hi all,
>
> I have made the following component: http://i.imgur.com/V7PRW4o.png
>
> It provides an image editing dialog that i want to use in a few of my 
> programs. However i thought to also use it with Lazarus instead of (or 
> in addition to ) the "Load image" dialog that appears when you click 
> on a "TPicture" (or similar) property like the Glyph of a 
> TSpeedButton, the icon of a program, the image for a menu, etc so one 
> can create an icon right there instead of using an external program 
> (the component also has two buttons to load/save images if one wants 
> to do that).
>
> Does anyone have any pointers towards doing that? I suspect there 
> aren't any "hooks" for that (the easiest would probably be adding a 
> button in the Load image dialog, but i think that is an unnecessary 
> extra click - click on the property, click on the button, draw stuff, 
> instead of click on the property, draw stuff). Where in the code 
> should i look at?
>
> I haven't uploaded the component anywhere yet, i want to try and do 
> that first so that the "design" package is distributed with the normal 
> component package :-)
>
> Thanks,
> Kostas
>

Open the file <Lazarus instal dir>\Components\ideintf\graphpropedits.pas 
and take a look on the TPicturePropertyEditor.edit implementation for a 
quick walk through on what is needed for a tpicture property editor. 
Then create your own package add the IDEintf package in the requirements 
in your unit create a new class derived from TGraphicPropertyEditor do 
your think, do not forget to copy and adjust the RegisterPropertyEditor 
for the tpicture type from the initialization section of the 
graphpropedits to your own units itinitialization section and then 
install that package to the IDE.

You should be seeing your property editor in the ide instead of the default.




More information about the Lazarus mailing list