1
0
Fork 0

Add edit_props example

This commit is contained in:
Timothy Warren 2021-10-12 11:24:36 -04:00
parent 307e0427ab
commit c031017ad9
5 changed files with 210 additions and 0 deletions

BIN
edit_props/edit_props.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

82
edit_props/edit_props.lpi Normal file
View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="edit_props"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="RunTimeTypeInfoControls"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="edit_props.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="edit_props"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

22
edit_props/edit_props.lpr Normal file
View File

@ -0,0 +1,22 @@
program edit_props;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, runtimetypeinfocontrols, umain
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

53
edit_props/umain.lfm Normal file
View File

@ -0,0 +1,53 @@
object Form1: TForm1
Left = 758
Height = 600
Top = 300
Width = 600
Caption = 'Form1'
ClientHeight = 600
ClientWidth = 600
LCLVersion = '2.0.12.0'
object Edit1: TEdit
Left = 8
Height = 22
Top = 8
Width = 80
TabOrder = 0
Text = 'Edit1'
end
object ToggleBox1: TToggleBox
Left = 9
Height = 25
Top = 64
Width = 167
Caption = 'Point grid to LabeledEdit'
OnChange = ToggleBox1Change
TabOrder = 1
end
object LabeledEdit1: TLabeledEdit
Left = 9
Height = 22
Top = 136
Width = 80
EditLabel.Height = 16
EditLabel.Width = 80
EditLabel.Caption = 'LabeledEdit1'
EditLabel.ParentColor = False
TabOrder = 2
Text = 'LabeledEdit1'
end
object TIPropertyGrid1: TTIPropertyGrid
Left = 184
Height = 600
Top = 0
Width = 416
Align = alRight
CheckboxForBoolean = False
DefaultValueFont.Color = clWindowText
Filter = [tkInteger, tkChar, tkEnumeration, tkFloat, tkSet, tkMethod, tkSString, tkLString, tkAString, tkWString, tkVariant, tkArray, tkRecord, tkInterface, tkClass, tkObject, tkWChar, tkBool, tkInt64, tkQWord, tkDynArray, tkInterfaceRaw, tkProcVar, tkUString, tkUChar, tkHelper, tkFile, tkClassRef, tkPointer]
Indent = 9
NameFont.Color = clWindowText
TIObject = Edit1
ValueFont.Color = clMaroon
end
end

53
edit_props/umain.pas Normal file
View File

@ -0,0 +1,53 @@
unit umain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
RTTIGrids;
type
{ TForm1 }
TForm1 = class(TForm)
Edit1: TEdit;
LabeledEdit1: TLabeledEdit;
TIPropertyGrid1: TTIPropertyGrid;
ToggleBox1: TToggleBox;
procedure ToggleBox1Change(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.ToggleBox1Change(Sender: TObject);
begin
case ToggleBox1.Checked of
False: begin
TIPropertyGrid1.TIObject := Edit1;
Edit1.SetFocus;
ToggleBox1.Caption := 'Point grid to LabeledEdit';
end;
True: begin
TIPropertyGrid1.TIObject := LabeledEdit1;
LabeledEdit1.SetFocus;
ToggleBox1.Caption := 'Point grid to Edit';
end;
end;
end;
end.