I want to add aboutbox/dialogbox on my Custom component. how to make the small button[...] appear on the object inspector? just like the assigning a picure on the Timage component.
You must define a property similar to this:
//: InformaciĆ³n acerca del paquete de componentes
property AboutMe:TFAbout read FAboutG stored false;
TFAbout is a class, that define the form that you want to see (About form), when the user click on the property in "Object Inspector".
Additionally, you must register a "Property Editor", if you want see a buuton with the three point |...| in OI.
This is a sample unit:
unit UTAboutProp;
interface
uses
DesignIntf, DesignEditors;
type
TAboutGProp = class(TPropertyEditor)
public
procedure Edit(); override;
function GetValue(): string; override;
function GetAttributes(): TPropertyAttributes; override;
end;
implementation
uses
SysUtils, FormAbout, UConstantes;
procedure TAboutGProp.Edit();
begin
with TFAbout.Create(nil) do
try
ShowModal();
finally
Free();
end;
end;
function TAboutGProp.GetValue(): string;
begin
result := Format(GLIBSI_LBL,[GLIBSI_VERSION]);
result := '1.0';
end;
function TAboutGProp.GetAttributes(): TPropertyAttributes;
begin
result := [paDialog,paReadOnly];
end;
end.
Only rest to "register" this "property Editor" for work with your About property; This is important for "link" your property with your editor.
Where you have the code for register the component, add the code for register the property:
RegisterPropertyEditor(TypeInfo(TFAbout),nil,'',TAboutGProp);
Regards