浏览代码

demo: Inspector: using lfm

mattias 3 周之前
父节点
当前提交
055a2f2a4f

+ 28 - 5
demo/Inspector/InspDemoForm1.lfm

@@ -1,8 +1,31 @@
 object DemoForm1: TDemoForm1
-  FormLeft = 168
-  FormTop = 236
-  FormWidth = 320
-  FormHeight = 600
+  FormLeft = 304
+  FormTop = 238
+  FormWidth = 313
+  FormHeight = 493
+  Stylesheet.Strings = (
+    'body {'
+    '  border: 3px solid blue;'
+    '  margin: 8px;'
+    '}'
+    'div {'
+    '  padding: 2px;'
+    '  border: 3px solid blue;'
+    '  margin: 6px;'
+    '  unknown: none;'
+    '  right: bla;'
+    '}'
+  )
   OnCreate = DemoForm1Create
-  Visible = true
+  Visible = True
+  object Body1: TBody
+    Style = 'position:absolute; box-sizing:border-box; left:32px; top:22px; width:224px; height:250px'
+    object Div1: TDiv
+      Style = 'position:absolute; box-sizing:border-box; left:14px; top:18px; width:162px; height:94px'
+      object Label1: TLabel
+        Style = 'position:absolute; box-sizing:border-box; left:22px; top:18px'
+        Caption = 'Hello'
+      end
+    end
+  end
 end

+ 3 - 23
demo/Inspector/InspDemoForm1.pas

@@ -12,12 +12,12 @@ type
   { TDemoForm1 }
 
   TDemoForm1 = class(TFresnelForm)
+    Body1: TBody;
+    Div1: TDiv;
+    Label1: TLabel;
     procedure DemoForm1Create(Sender: TObject);
   private
   public
-    Body: TBody;
-    Div1: TDiv;
-    Label1: TLabel;
   end;
 
 var
@@ -31,27 +31,7 @@ implementation
 
 procedure TDemoForm1.DemoForm1Create(Sender: TObject);
 begin
-  Body:=TBody.Create(Self);
-  with Body do begin
-    Name:='Body';
-    Parent:=Self;
-  end;
-
-  Div1:=TDiv.Create(Self);
-  with Div1 do begin
-    Name:='Div1';
-    Parent:=Body;
-    Style:='height: 100px; padding-left: 5px;';
-  end;
-
-  Label1:=TLabel.Create(Self);
-  with Label1 do begin
-    Name:='Label1';
-    Caption:='Hello';
-    Parent:=Div1;
-  end;
 
-  Stylesheet.Text:='div { padding: 2px; border: 3px solid blue; margin: 6px; unknown: none; right: bla; }';
 end;
 
 end.

+ 1 - 7
demo/Inspector/InspDemoStyles1.pas

@@ -33,16 +33,10 @@ implementation
 
 procedure TDemoStylesWindow.DemoStylesWindowCreate(Sender: TObject);
 begin
-  FBody:=TBody.Create(Self);
-  with Body do begin
-    Name:='Body';
-    Parent:=Self;
-  end;
-
   FCSSStyleInspector:=TCSSStyleInspector.Create(Self);
   with CSSStyleInspector do begin
     Name:='CSSStyleInspector';
-    Parent:=Body;
+    Parent:=Self;
   end;
 
   Stylesheet.Text:=':root { color: #fff; font-size: 15px; background-color: #333; }';

+ 0 - 0
demo/Inspector/fresnel.cssstyleinspector.pas → src/base/fresnel.cssstyleinspector.pas