123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- unit MainUnit;
- {$mode ObjFPC}{$H+}
- interface
- uses
- Classes, SysUtils, Fresnel.Forms, Fresnel.Controls, Fresnel.Events,
- FCL.Events, Fresnel.Edit, Fresnel.Classes;
- type
- { TMainForm }
- TMainForm = class(TFresnelForm)
- Body1: TBody;
- Div1: TDiv;
- Label1: TLabel;
- Edit1 : TEdit;
- procedure Label1Click(Event: TAbstractEvent);
- private
- FBlocked : Boolean;
- public
- constructor CreateNew(aOwner: TComponent); override;
- end;
- var
- MainForm: TMainForm;
- implementation
- { TMainForm }
- procedure TMainForm.Label1Click(Event: TAbstractEvent);
- begin
- FBlocked:=Not FBlocked;
- if FBlocked then
- Label1.Caption:='Allow typing'
- else
- Label1.Caption:='Block typing';
- end;
- constructor TMainForm.CreateNew(aOwner: TComponent);
- begin
- inherited CreateNew(aOWner);
- Caption:='Edit demo';
- FormBounds:=BoundsRectFre(450,300,350,255);
- Stylesheet.Text:=
- 'div {'+
- ' padding: 3px; '+
- ' border: 2px solid black; '+
- ' margin: 6px;'+
- '}'+sLineBreak+
- 'input::selection { color: red; background-color: white } ' ;
- Body1:=TBody.Create(Self);
- Body1.Parent:=Self;
- Body1.Style:='border: 2px solid blue;'#10;
- Body1.Name:='Body1';
- Div1:=TDiv.Create(Self);
- Div1.Parent:=Body1;
- Div1.Style:='background-color: blue;'#10'border-color: black;'#10'height:30px;';
- Div1.Name:='Div1';
- Label1:=TLabel.Create(Self);
- Label1.Parent:=Div1;
- With Label1 do
- begin
- Name:='Label1';
- Style := 'color: red;';
- Caption := 'Block typing';
- OnClick := @Label1Click;
- end;
- Stylesheet.Add('div {'
- //+' background:#44cc66;'
- +' background:linear-gradient(#ededed, #bab1ba);'
- +' border:7px solid #18ab29;'
- +' padding:16px 31px;'
- +' font-size:15px; '
- +' font-family:Arial; '
- + ' font-weight:bold;'
- +' text-shadow: 0 1 1 #333;'
- +' color:#fff;'
- +'}'
- +'div:hover {'
- +' background:#88bb22;'
- +'};');
- Edit1:=TEdit.Create(Self);
- Edit1.Name:='Edit1';
- Edit1.Value:='Edit1';
- Edit1.Parent:=Body1;
- Edit1.Style:='font-size:15px; family:Arial; background-color: yellow;'#10
- +'border-color: black;'#10
- +'height:30px;'#10
- +'width: 100px;'#10;
- Edit1.Focus;
- Visible:=true;
- end;
- end.
|