Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit View.Components.Edit004;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils,
- System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
- Vcl.StdCtrls, Vcl.ExtCtrls,
- View.Components.Interfaces,
- View.Components.Attributes.Interfaces,
- View.Components.Attributes,
- View.Styles.States,
- View.Services.Utils,
- View.Styles.Colors;
- type
- TComponentEdit004 = class(TForm, iComponents<TComponentEdit004>)
- Panel1: TPanel;
- Panel2: TPanel;
- Panel4: TPanel;
- Panel5: TPanel;
- Panel6: TPanel;
- Edit1: TEdit;
- Panel8: TPanel;
- Label1: TLabel;
- Panel7: TPanel;
- procedure FormCreate(Sender: TObject);
- procedure Edit1Enter(Sender: TObject);
- procedure Edit1Exit(Sender: TObject);
- private
- { Private declarations }
- FAttributes : iComponentAttributes<TComponentEdit004>;
- FFieldValue : ^String; //ponteiro endereço de memória
- FContainer : TWinControl;
- public
- { Public declarations }
- function Component : TWinControl;
- function Attributes : iComponentAttributes<TComponentEdit004>;
- function LoadAttributes (aValue : String) : TComponentEdit004;
- function FieldValue(var aFieldValue : String) : TComponentEdit004;
- function Container (aValue : TWinControl) : iComponents<TComponentEdit004>;
- function This : TComponentEdit004;
- end;
- var
- ComponentEdit004: TComponentEdit004;
- implementation
- {$R *.dfm}
- { TComponentEdit004 }
- function TComponentEdit004.Attributes: iComponentAttributes<TComponentEdit004>;
- begin
- Result := FAttributes;
- end;
- function TComponentEdit004.Component: TWinControl;
- begin
- Result := Panel1;
- if Assigned(FContainer) then
- Panel1.Parent:=FContainer;
- Panel1.Visible:=True;
- Edit1.Color:=WHITE;
- Edit1.Font.Color := FAttributes.FontColor;
- Edit1.Refresh;
- Label1.Caption:= FAttributes.Title;
- Label1.Font.Color := INFO;
- // Edit1.Text:= FAttributes.Title;
- Edit1.Text:= '';
- Panel1.Color:= LIGHT2;
- Panel2.Color:= WHITE;
- Panel8.Color:= WHITE;
- Panel7.Color:= INFO;
- Panel1.Align := FAttributes.Align;
- end;
- function TComponentEdit004.Container(
- aValue: TWinControl): iComponents<TComponentEdit004>;
- begin
- Result := Self;
- FContainer := aValue;
- end;
- procedure TComponentEdit004.Edit1Enter(Sender: TObject);
- begin
- // if Edit1.Text = FAttributes.Title then
- // Edit1.Text := '';
- Panel7.Height:= 2;
- Panel7.Color := PRIMARY;
- end;
- procedure TComponentEdit004.Edit1Exit(Sender: TObject);
- begin
- // if Edit1.Text = '' then
- // Edit1.Text := FAttributes.Title;
- Panel7.Height:= 1;
- Panel7.Color := INFO;
- end;
- function TComponentEdit004.FieldValue(
- var aFieldValue: String): TComponentEdit004;
- begin
- Result := Self;
- FFieldValue := @aFieldValue;
- end;
- procedure TComponentEdit004.FormCreate(Sender: TObject);
- begin
- FAttributes := TComponentAttributes<TComponentEdit004>.New(Self);
- end;
- function TComponentEdit004.LoadAttributes(aValue: String): TComponentEdit004;
- var
- FLoadAttributes : iComponentAttributes<TComponentEdit004>;
- begin
- Result := Self;
- FLoadAttributes := (StylesStates.GetStyle(aValue) as iComponentAttributes<TComponentEdit004>);
- FAttributes := FLoadAttributes.Clone;
- FAttributes.Parent(Self);
- end;
- function TComponentEdit004.This: TComponentEdit004;
- begin
- Result := Self;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement