Einzelnen Beitrag anzeigen

jbg

Registriert seit: 12. Jun 2002
3.481 Beiträge
 
Delphi 10.1 Berlin Professional
 
#2

Re: Button hinzufügen JInspector

  Alt 8. Sep 2008, 11:20
Das hier habe ich mal schnell zusammengeschrieben (=zusammenkopiert)
Delphi-Quellcode:
type
  TJvInspectorPictureItem = class(TJvCustomInspectorItem)
  protected
    function GetDisplayValue: string; override;
    procedure Edit; override;
  public
    constructor Create(const AParent: TJvCustomInspectorItem; const AData: TJvCustomInspectorData); override;
  end;


constructor TJvInspectorPictureItem .Create(const AParent: TJvCustomInspectorItem;
  const AData: TJvCustomInspectorData);
begin
  inherited Create(AParent, AData);
  Flags := Flags + [iifEditButton, iifEditFixed];
end;

function TJvInspectorPictureItem.GetDisplayValue: string;
begin
  if TPicture(Data.AsOrdinal).IsEmpty then
    Result := '(kein Bild)'
  else
    Result := '(Bild)';
end;

procedure TJvInspectorMacroItem.Edit;
var
  Pic: TPicture;
begin
  Pic := TPicture(Data.AsOrdinal);
  ShowPictureEditor(Pic);
end;


initialization
  TJvCustomInspectorData.ItemRegister.Add(TJvInspectorTypeInfoRegItem.Create(TJvInspectorPictureItem , TypeInfo(TPicture)));
end.
  Mit Zitat antworten Zitat