Advertisement
jpfassis

ComponentEdit004 - Delphi

Jul 16th, 2022
1,446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 3.35 KB | None | 0 0
  1. unit View.Components.Edit004;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils,
  7.   System.Variants, System.Classes, Vcl.Graphics,
  8.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs,
  9.   Vcl.StdCtrls, Vcl.ExtCtrls,
  10.  
  11.   View.Components.Interfaces,
  12.   View.Components.Attributes.Interfaces,
  13.   View.Components.Attributes,
  14.   View.Styles.States,
  15.   View.Services.Utils,
  16.   View.Styles.Colors;
  17.  
  18. type
  19.   TComponentEdit004 = class(TForm, iComponents<TComponentEdit004>)
  20.     Panel1: TPanel;
  21.     Panel2: TPanel;
  22.     Panel4: TPanel;
  23.     Panel5: TPanel;
  24.     Panel6: TPanel;
  25.     Edit1: TEdit;
  26.     Panel8: TPanel;
  27.     Label1: TLabel;
  28.     Panel7: TPanel;
  29.     procedure FormCreate(Sender: TObject);
  30.     procedure Edit1Enter(Sender: TObject);
  31.     procedure Edit1Exit(Sender: TObject);
  32.   private
  33.     { Private declarations }
  34.     FAttributes : iComponentAttributes<TComponentEdit004>;
  35.     FFieldValue : ^String; //ponteiro endereço de memória
  36.     FContainer : TWinControl;
  37.   public
  38.     { Public declarations }
  39.     function Component : TWinControl;
  40.     function Attributes : iComponentAttributes<TComponentEdit004>;
  41.     function LoadAttributes (aValue : String) : TComponentEdit004;
  42.     function FieldValue(var aFieldValue : String) : TComponentEdit004;
  43.     function Container (aValue : TWinControl) : iComponents<TComponentEdit004>;
  44.     function This : TComponentEdit004;
  45.   end;
  46.  
  47. var
  48.   ComponentEdit004: TComponentEdit004;
  49.  
  50. implementation
  51.  
  52. {$R *.dfm}
  53.  
  54. { TComponentEdit004 }
  55.  
  56. function TComponentEdit004.Attributes: iComponentAttributes<TComponentEdit004>;
  57. begin
  58.   Result := FAttributes;
  59. end;
  60.  
  61. function TComponentEdit004.Component: TWinControl;
  62. begin
  63.   Result := Panel1;
  64.   if Assigned(FContainer) then
  65.   Panel1.Parent:=FContainer;
  66.  
  67.   Panel1.Visible:=True;
  68.   Edit1.Color:=WHITE;
  69.   Edit1.Font.Color := FAttributes.FontColor;
  70.   Edit1.Refresh;
  71.   Label1.Caption:= FAttributes.Title;
  72.   Label1.Font.Color := INFO;
  73. //  Edit1.Text:= FAttributes.Title;
  74.   Edit1.Text:= '';
  75.  
  76.   Panel1.Color:= LIGHT2;
  77.   Panel2.Color:= WHITE;
  78.   Panel8.Color:= WHITE;
  79.   Panel7.Color:= INFO;
  80.   Panel1.Align := FAttributes.Align;
  81.  
  82. end;
  83.  
  84. function TComponentEdit004.Container(
  85.   aValue: TWinControl): iComponents<TComponentEdit004>;
  86. begin
  87.   Result := Self;
  88.   FContainer := aValue;
  89. end;
  90.  
  91. procedure TComponentEdit004.Edit1Enter(Sender: TObject);
  92. begin
  93.  
  94. // if Edit1.Text = FAttributes.Title then
  95. //    Edit1.Text := '';
  96.  Panel7.Height:= 2;
  97.  Panel7.Color := PRIMARY;
  98. end;
  99.  
  100. procedure TComponentEdit004.Edit1Exit(Sender: TObject);
  101. begin
  102. // if Edit1.Text = ''  then
  103. //    Edit1.Text := FAttributes.Title;
  104.  Panel7.Height:= 1;
  105.  Panel7.Color := INFO;
  106. end;
  107.  
  108. function TComponentEdit004.FieldValue(
  109.   var aFieldValue: String): TComponentEdit004;
  110. begin
  111.   Result := Self;
  112.   FFieldValue := @aFieldValue;
  113. end;
  114.  
  115. procedure TComponentEdit004.FormCreate(Sender: TObject);
  116. begin
  117.   FAttributes := TComponentAttributes<TComponentEdit004>.New(Self);
  118. end;
  119.  
  120. function TComponentEdit004.LoadAttributes(aValue: String): TComponentEdit004;
  121. var
  122.   FLoadAttributes : iComponentAttributes<TComponentEdit004>;
  123. begin
  124.  
  125.  Result := Self;
  126.  FLoadAttributes := (StylesStates.GetStyle(aValue) as iComponentAttributes<TComponentEdit004>);
  127.  
  128.  FAttributes := FLoadAttributes.Clone;
  129.  FAttributes.Parent(Self);
  130.  
  131. end;
  132.  
  133. function TComponentEdit004.This: TComponentEdit004;
  134. begin
  135.   Result := Self;
  136. end;
  137.  
  138. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement