Witam potrzebuje bardzo napisać nowy komponent, który właśnie zmienia wartość coption po kliknięciu. Można to niby łatwo zrobić w kodzie programu, ale właśnie musi byc komponent :)
unit QDoubleButton;
interface
uses
SysUtils, Classes, QControls, QStdCtrls;
type
DoubleButton = class(TButton)
private
FOnClick: TNotifyEvent;
FCoption2:string;
FSortowanie:boolean;
protected
function
//function OnClick:TNotifyEvent read FOnClick write FOnClick;
public
constructor create(aowner:tcomponent);override;
destructor destroy(); override;
published
property Caption;
property Caption2:string read fCaption2 write fCaption2;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [DoubleButton]);
end;
procedure DoubleButton.OnClick(sender: TObject);
var tmp:string;
begin
tmp:=DoubleButton.Caption;
if DoubleButton.FSortowanie=True then
DoubleButton.FSortowanie:=False else
DobleButton.Fsortowanie:=True;
DoubleButton.Caption:=DoubleButton.Caption2;
DoubleButton.Caption2:=tmp;
end;
end.
na razie mam taki, który nie daje sie skompilować , byłbym wdzięczny za jakieś sugestie
Pozdrawiam