converted Load Image Dialog to lfm, bugfixes from Tomas Gregorovic

git-svn-id: trunk@8536 -
This commit is contained in:
mattias 2006-01-17 10:47:57 +00:00
parent 65f3a8f2e1
commit 8e6d3236a6
4 changed files with 117 additions and 274 deletions

View File

@ -165,200 +165,12 @@ type
implementation
uses
GraphicPropEdit; // defines TGraphicPropertyEditorForm
var
DummyClassForPropTypes: TDummyClassForGraphPropTypes;
{Form For Picture/Graphic Property Editor}
type
TGraphicPropertyEditorForm = class(TForm)
procedure GraphicPropertyEditorFormResize(Sender: TObject);
private
FModified: boolean;
procedure SetModified(const AValue: boolean);
protected
Opendlg: TOpenPictureDialog;
Savedlg: TSavePictureDialog;
OKBTN: TBITBTN;
CANCELBTN: TBITBTN;
LoadBTN: TBUTTON;
SaveBTN: TBUTTON;
ClearBTN : TBUTTON;
ScrollBox : TScrollBox;
procedure LoadBTNCLICK(Sender: TObject);
procedure SaveBTNCLICK(Sender: TObject);
procedure ClearBTNCLICK(Sender: TObject);
public
Preview: TIMAGE;
FileName : String;
Constructor Create(AOwner : TComponent); Override;
property Modified: boolean read FModified write SetModified;
end;
Constructor TGraphicPropertyEditorForm.Create(AOwner : TComponent);
begin
Inherited Create(AOwner);
FileName := '';
Position := poDesktopCenter;
Caption := oisLoadImageDialog;
HEIGHT := 419;
WIDTH := 403;
Opendlg := TOpenPictureDialog.Create(Self);
Savedlg := TSavePictureDialog.Create(Self);
OKBTN := TBITBTN.Create(Self);
With OKBTN do begin
Parent := Self;
KIND := bkok;
SPACING := 3;
MODALRESULT := mrOK;
CAPTION := oisOK;
end;
ScrollBox := TScrollBox.Create(Self);
With ScrollBox do begin
Parent := Self;
AutoSize := False;
Color := clWhite;
AutoScroll := True;
end;
Preview := TIMAGE.Create(ScrollBox);
With Preview do begin
Parent := ScrollBox;
AutoSize:=true;
Transparent := True;
Center := True;
Stretch := False;
end;
CANCELBTN := TBITBTN.Create(Self);
With CANCELBTN do begin
Parent := Self;
KIND := bkcancel;
SPACING := 3;
MODALRESULT := mrCancel;
CAPTION := oisCancel;
end;
LoadBTN := TBUTTON.Create(Self);
With LoadBTN do begin
Parent := Self;
CAPTION := oisLoadPicture;
ONCLICK := @LoadBTNCLICK;
end;
SaveBTN := TBUTTON.Create(Self);
With SaveBTN do begin
Parent := Self;
ENABLED := False;
CAPTION := oisSavePicture;
ONCLICK := @SaveBTNCLICK;
end;
ClearBTN := TBUTTON.Create(Self);
With ClearBTN do begin
Parent := Self;
CAPTION := oisClearPicture;
ONCLICK := @ClearBTNCLICK;
end;
OnResize:=@GraphicPropertyEditorFormResize;
OnResize(Self);
end;
procedure TGraphicPropertyEditorForm.GraphicPropertyEditorFormResize(
Sender: TObject);
var
x: Integer;
y: Integer;
w: Integer;
begin
with ScrollBox do begin
SetBounds(8,8,Parent.ClientWidth-108,Parent.ClientHeight-43);
end;
with OKBTN do begin
SetBounds(Parent.ClientWidth-95,10,90,Height);
end;
with CANCELBTN do begin
SetBounds(OKBTN.Left,OKBTN.Top+OKBTN.Height+10,OKBTN.Width,Height);
end;
x:=5;
y:=ClientHeight-30;
w:=(ClientWidth-20) div 3;
with LoadBTN do begin
SetBounds(x,y,w,Height);
inc(x,w+5);
end;
with SaveBTN do begin
SetBounds(x,y,w,Height);
inc(x,w+5);
end;
with ClearBTN do begin
SetBounds(x,y,w,Height);
inc(x,w+5);
end;
end;
procedure TGraphicPropertyEditorForm.SetModified(const AValue: boolean);
begin
if FModified=AValue then exit;
FModified:=AValue;
end;
procedure TGraphicPropertyEditorForm.LoadBTNCLICK(Sender: TObject);
begin
If OpenDlg.Execute then begin
FileName := OpenDlg.FileName;
try
Preview.Picture.LoadFromFile(FileName);
Modified:=true;
except
on E: Exception do begin
MessageDlg(oisErrorLoadingImage,
Format(oisErrorLoadingImage2, ['"', FileName, '"', #13, E.Message]),
mtError,[mbOk],0);
end;
end;
end;
SaveBTN.Enabled := False;
If Assigned(Preview.Picture.Graphic) then
If not Preview.Picture.Graphic.Empty then
SaveBTN.Enabled := True;
end;
procedure TGraphicPropertyEditorForm.SaveBTNCLICK(Sender: TObject);
begin
If SaveDlg.Execute then
Preview.Picture.SaveToFile(SaveDlg.FileName);
end;
procedure TGraphicPropertyEditorForm.ClearBTNCLICK(Sender: TObject);
begin
With Preview do begin
Picture.Graphic := nil;
Width := 0;
Height := 0;
end;
ScrollBox.Invalidate;
SaveBTN.Enabled := False;
Modified:=true;
end;
{ TGraphicPropertyEditor }
procedure TGraphicPropertyEditor.Edit;
var

View File

@ -1,4 +1,5 @@
object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
ActiveControl = BtnOK
BorderIcons = [biSystemMenu, biHelp]
Caption = 'TreeView Items Editor'
ClientHeight = 261
@ -61,7 +62,6 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Caption = 'Items'
ClientHeight = 195
ClientWidth = 276
ParentColor = True
TabOrder = 4
Left = 8
Height = 213
@ -126,7 +126,6 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
end
object BtnSave: TButton
Anchors = [akTop, akRight]
BorderSpacing.OnChange = nil
BorderSpacing.InnerBorder = 2
Caption = '&Save'
OnClick = btnSaveClick
@ -142,7 +141,6 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Caption = 'Item Properties'
ClientHeight = 195
ClientWidth = 181
ParentColor = True
TabOrder = 5
Left = 296
Height = 213
@ -152,37 +150,41 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Caption = 'Text:'
Color = clNone
FocusControl = edtText
ParentColor = False
Left = 8
Height = 17
Height = 14
Top = 10
Width = 65
Width = 27
end
object Label2: TLabel
Caption = 'Image Index:'
Color = clNone
FocusControl = edtIndexImg
ParentColor = False
Left = 9
Height = 17
Height = 14
Top = 44
Width = 65
Width = 66
end
object Label3: TLabel
Caption = 'Selected index:'
Color = clNone
FocusControl = edtIndexSel
ParentColor = False
Left = 6
Height = 17
Height = 14
Top = 78
Width = 78
Width = 75
end
object Label4: TLabel
Caption = 'State Index:'
Color = clNone
FocusControl = edtIndexState
ParentColor = False
Left = 8
Height = 17
Height = 14
Top = 110
Width = 65
Width = 62
end
object edtText: TEdit
OnChange = Edit1Change
@ -221,14 +223,14 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Title = 'Open'
FilterIndex = 0
Title = 'Open'
left = 5
top = 237
left = 176
top = 312
end
object SaveDialog1: TSaveDialog
Title = 'Save'
FilterIndex = 0
Title = 'Save'
left = 5
top = 272
left = 176
top = 347
end
end

View File

@ -1,68 +1,69 @@
{ Ýòî - ôàéë ðåñóðñîâ, àâòîìàòè÷åñêè ñîçäàííûé lazarus }
LazarusResources.Add('TTreeViewItemsEditorForm','FORMDATA',[
'TPF0'#24'TTreeViewItemsEditorForm'#23'TreeViewItemsEditorForm'#11'BorderIcon'
+'s'#11#12'biSystemMenu'#6'biHelp'#0#7'Caption'#6#21'TreeView Items Editor'#12
+'ClientHeight'#3#5#1#11'ClientWidth'#3#231#1#8'OnCreate'#7#10'FormCreate'#13
+'PixelsPerInch'#2'`'#8'Position'#7#15'poDesktopCenter'#18'HorzScrollBar.Page'
+#3#230#1#18'VertScrollBar.Page'#3#4#1#4'Left'#3'9'#1#6'Height'#3#5#1#3'Top'#3
+#194#0#5'Width'#3#231#1#0#7'TButton'#5'BtnOK'#7'Anchors'#11#7'akRight'#8'akB'
+'ottom'#0#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#2'OK'#11'ModalResul'
+'t'#2#1#8'TabOrder'#2#0#4'Left'#3#166#0#6'Height'#2#25#3'Top'#3#229#0#5'Widt'
+'h'#2'K'#0#0#7'TButton'#9'BtnCancel'#7'Anchors'#11#7'akRight'#8'akBottom'#0
+#25'BorderSpacing.InnerBorder'#2#2#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'Mod'
+'alResult'#2#2#8'TabOrder'#2#1#4'Left'#3#246#0#6'Height'#2#25#3'Top'#3#229#0
+#5'Width'#2'K'#0#0#7'TButton'#8'BtnApply'#7'Anchors'#11#7'akRight'#8'akBotto'
+'m'#0#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#6'&Apply'#7'OnClick'#7
+#13'btnApplyClick'#8'TabOrder'#2#2#4'Left'#3'F'#1#6'Height'#2#25#3'Top'#3#229
+#0#5'Width'#2'K'#0#0#7'TButton'#7'BtnHelp'#7'Anchors'#11#7'akRight'#8'akBott'
+'om'#0#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#4'Help'#8'TabOrder'#2#3
+#4'Left'#3#150#1#6'Height'#2#25#3'Top'#3#229#0#5'Width'#2'K'#0#0#9'TGroupBox'
+#9'GroupBox1'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Ca'
+'ption'#6#5'Items'#12'ClientHeight'#3#195#0#11'ClientWidth'#3#20#1#11'Parent'
+'Color'#9#8'TabOrder'#2#4#4'Left'#2#8#6'Height'#3#213#0#3'Top'#2#8#5'Width'#3
+#24#1#0#9'TTreeView'#9'TreeView1'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'
+#8'akBottom'#0#17'DefaultItemHeight'#2#15#13'HideSelection'#8#8'TabOrder'#2#0
+#18'OnSelectionChanged'#7#25'TreeView1SelectionChanged'#7'Options'#11#17'tvo'
+'AutoItemHeight'#21'tvoKeepCollapsedNodes'#14'tvoShowButtons'#12'tvoShowLine'
+'s'#11'tvoShowRoot'#11'tvoToolTips'#0#4'Left'#2#6#6'Height'#3#188#0#5'Width'
+#3#185#0#0#0#7'TButton'#10'BtnNewItem'#7'Anchors'#11#5'akTop'#7'akRight'#0#25
+'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#9'&New Item'#7'Default'#9#7'OnC'
+'lick'#7#15'BtnNewItemClick'#8'TabOrder'#2#1#4'Left'#3#198#0#6'Height'#2#25#3
+'Top'#2#4#5'Width'#2'K'#3'Tag'#2#1#0#0#7'TButton'#13'BtnNewSubItem'#7'Anchor'
+'s'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6
+#12'N&ew SubItem'#7'OnClick'#7#15'BtnNewItemClick'#8'TabOrder'#2#2#4'Left'#3
+#198#0#6'Height'#2#25#3'Top'#2'$'#5'Width'#2'K'#0#0#7'TButton'#9'BtnDelete'#7
+'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#2#7'Capti'
+'on'#6#7'&Delete'#7'OnClick'#7#14'btnDeleteClick'#8'TabOrder'#2#3#4'Left'#3
+#198#0#6'Height'#2#25#3'Top'#2'F'#5'Width'#2'K'#0#0#7'TButton'#7'BtnLoad'#7
+'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#2#7'Capti'
+'on'#6#5'&Load'#7'OnClick'#7#12'btnLoadClick'#8'TabOrder'#2#4#4'Left'#3#198#0
+#6'Height'#2#25#3'Top'#2'f'#5'Width'#2'K'#0#0#7'TButton'#7'BtnSave'#7'Anchor'
+'s'#11#5'akTop'#7'akRight'#0#22'BorderSpacing.OnChange'#13#25'BorderSpacing.'
+'InnerBorder'#2#2#7'Caption'#6#5'&Save'#7'OnClick'#7#12'btnSaveClick'#8'TabO'
+'rder'#2#5#4'Left'#3#198#0#6'Height'#2#25#3'Top'#3#136#0#5'Width'#2'K'#0#0#0
+#9'TGroupBox'#9'GroupBox2'#7'Anchors'#11#5'akTop'#7'akRight'#8'akBottom'#0#7
+'Caption'#6#15'Item Properties'#12'ClientHeight'#3#195#0#11'ClientWidth'#3
+#181#0#11'ParentColor'#9#8'TabOrder'#2#5#4'Left'#3'('#1#6'Height'#3#213#0#3
+'Top'#2#8#5'Width'#3#185#0#0#6'TLabel'#6'Label1'#7'Caption'#6#5'Text:'#5'Col'
+'or'#7#6'clNone'#12'FocusControl'#7#7'edtText'#4'Left'#2#8#6'Height'#2#17#3
+'Top'#2#10#5'Width'#2'A'#0#0#6'TLabel'#6'Label2'#7'Caption'#6#12'Image Index'
+':'#5'Color'#7#6'clNone'#12'FocusControl'#7#11'edtIndexImg'#4'Left'#2#9#6'He'
+'ight'#2#17#3'Top'#2','#5'Width'#2'A'#0#0#6'TLabel'#6'Label3'#7'Caption'#6#15
+'Selected index:'#5'Color'#7#6'clNone'#12'FocusControl'#7#11'edtIndexSel'#4
+'Left'#2#6#6'Height'#2#17#3'Top'#2'N'#5'Width'#2'N'#0#0#6'TLabel'#6'Label4'#7
+'Caption'#6#12'State Index:'#5'Color'#7#6'clNone'#12'FocusControl'#7#13'edtI'
+'ndexState'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'n'#5'Width'#2'A'#0#0#5'TEdit'
+#7'edtText'#8'OnChange'#7#11'Edit1Change'#8'TabOrder'#2#0#4'Left'#2'V'#6'Hei'
+'ght'#2#23#3'Top'#2#4#5'Width'#2'['#0#0#5'TEdit'#11'edtIndexImg'#13'OnEditin'
+'gDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#1#4'Left'#2'V'#6'Height'
+#2#23#3'Top'#2'&'#5'Width'#2'0'#0#0#5'TEdit'#11'edtIndexSel'#13'OnEditingDon'
+'e'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#2#4'Left'#2'V'#6'Height'#2
+#23#3'Top'#2'H'#5'Width'#2'0'#0#0#5'TEdit'#13'edtIndexState'#13'OnEditingDon'
+'e'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2#3#4'Left'#2'V'#6'Height'#2
+#23#3'Top'#2'h'#5'Width'#2'0'#0#0#0#11'TOpenDialog'#11'OpenDialog1'#5'Title'
+#6#4'Open'#11'FilterIndex'#2#0#5'Title'#6#4'Open'#4'left'#2#5#3'top'#3#237#0
+#0#0#11'TSaveDialog'#11'SaveDialog1'#5'Title'#6#4'Save'#11'FilterIndex'#2#0#5
+'Title'#6#4'Save'#4'left'#2#5#3'top'#3#16#1#0#0#0
'TPF0'#24'TTreeViewItemsEditorForm'#23'TreeViewItemsEditorForm'#13'ActiveCont'
+'rol'#7#5'BtnOK'#11'BorderIcons'#11#12'biSystemMenu'#6'biHelp'#0#7'Caption'#6
+#21'TreeView Items Editor'#12'ClientHeight'#3#5#1#11'ClientWidth'#3#231#1#8
+'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'`'#8'Position'#7#15'poDeskto'
+'pCenter'#18'HorzScrollBar.Page'#3#230#1#18'VertScrollBar.Page'#3#4#1#4'Left'
+#3'9'#1#6'Height'#3#5#1#3'Top'#3#194#0#5'Width'#3#231#1#0#7'TButton'#5'BtnOK'
+#7'Anchors'#11#7'akRight'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#2#7
+'Caption'#6#2'OK'#11'ModalResult'#2#1#8'TabOrder'#2#0#4'Left'#3#166#0#6'Heig'
+'ht'#2#25#3'Top'#3#229#0#5'Width'#2'K'#0#0#7'TButton'#9'BtnCancel'#7'Anchors'
+#11#7'akRight'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#2#6'Cancel'#9#7
+'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#1#4'Left'#3#246#0#6
+'Height'#2#25#3'Top'#3#229#0#5'Width'#2'K'#0#0#7'TButton'#8'BtnApply'#7'Anch'
+'ors'#11#7'akRight'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#2#7'Captio'
+'n'#6#6'&Apply'#7'OnClick'#7#13'btnApplyClick'#8'TabOrder'#2#2#4'Left'#3'F'#1
+#6'Height'#2#25#3'Top'#3#229#0#5'Width'#2'K'#0#0#7'TButton'#7'BtnHelp'#7'Anc'
+'hors'#11#7'akRight'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#2#7'Capti'
+'on'#6#4'Help'#8'TabOrder'#2#3#4'Left'#3#150#1#6'Height'#2#25#3'Top'#3#229#0
+#5'Width'#2'K'#0#0#9'TGroupBox'#9'GroupBox1'#7'Anchors'#11#5'akTop'#6'akLeft'
+#7'akRight'#8'akBottom'#0#7'Caption'#6#5'Items'#12'ClientHeight'#3#195#0#11
+'ClientWidth'#3#20#1#8'TabOrder'#2#4#4'Left'#2#8#6'Height'#3#213#0#3'Top'#2#8
+#5'Width'#3#24#1#0#9'TTreeView'#9'TreeView1'#7'Anchors'#11#5'akTop'#6'akLeft'
+#7'akRight'#8'akBottom'#0#17'DefaultItemHeight'#2#15#13'HideSelection'#8#8'T'
+'abOrder'#2#0#18'OnSelectionChanged'#7#25'TreeView1SelectionChanged'#7'Optio'
+'ns'#11#17'tvoAutoItemHeight'#21'tvoKeepCollapsedNodes'#14'tvoShowButtons'#12
+'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#4'Left'#2#6#6'Height'#3#188
+#0#5'Width'#3#185#0#0#0#7'TButton'#10'BtnNewItem'#7'Anchors'#11#5'akTop'#7'a'
+'kRight'#0#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#9'&New Item'#7'Def'
+'ault'#9#7'OnClick'#7#15'BtnNewItemClick'#8'TabOrder'#2#1#4'Left'#3#198#0#6
+'Height'#2#25#3'Top'#2#4#5'Width'#2'K'#3'Tag'#2#1#0#0#7'TButton'#13'BtnNewSu'
+'bItem'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#2
+#7'Caption'#6#12'N&ew SubItem'#7'OnClick'#7#15'BtnNewItemClick'#8'TabOrder'#2
+#2#4'Left'#3#198#0#6'Height'#2#25#3'Top'#2'$'#5'Width'#2'K'#0#0#7'TButton'#9
+'BtnDelete'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'
+#2#2#7'Caption'#6#7'&Delete'#7'OnClick'#7#14'btnDeleteClick'#8'TabOrder'#2#3
+#4'Left'#3#198#0#6'Height'#2#25#3'Top'#2'F'#5'Width'#2'K'#0#0#7'TButton'#7'B'
+'tnLoad'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2
+#2#7'Caption'#6#5'&Load'#7'OnClick'#7#12'btnLoadClick'#8'TabOrder'#2#4#4'Lef'
+'t'#3#198#0#6'Height'#2#25#3'Top'#2'f'#5'Width'#2'K'#0#0#7'TButton'#7'BtnSav'
+'e'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#2#7
+'Caption'#6#5'&Save'#7'OnClick'#7#12'btnSaveClick'#8'TabOrder'#2#5#4'Left'#3
+#198#0#6'Height'#2#25#3'Top'#3#136#0#5'Width'#2'K'#0#0#0#9'TGroupBox'#9'Grou'
+'pBox2'#7'Anchors'#11#5'akTop'#7'akRight'#8'akBottom'#0#7'Caption'#6#15'Item'
+' Properties'#12'ClientHeight'#3#195#0#11'ClientWidth'#3#181#0#8'TabOrder'#2
+#5#4'Left'#3'('#1#6'Height'#3#213#0#3'Top'#2#8#5'Width'#3#185#0#0#6'TLabel'#6
+'Label1'#7'Caption'#6#5'Text:'#5'Color'#7#6'clNone'#12'FocusControl'#7#7'edt'
+'Text'#11'ParentColor'#8#4'Left'#2#8#6'Height'#2#14#3'Top'#2#10#5'Width'#2#27
+#0#0#6'TLabel'#6'Label2'#7'Caption'#6#12'Image Index:'#5'Color'#7#6'clNone'
+#12'FocusControl'#7#11'edtIndexImg'#11'ParentColor'#8#4'Left'#2#9#6'Height'#2
+#14#3'Top'#2','#5'Width'#2'B'#0#0#6'TLabel'#6'Label3'#7'Caption'#6#15'Select'
+'ed index:'#5'Color'#7#6'clNone'#12'FocusControl'#7#11'edtIndexSel'#11'Paren'
+'tColor'#8#4'Left'#2#6#6'Height'#2#14#3'Top'#2'N'#5'Width'#2'K'#0#0#6'TLabel'
+#6'Label4'#7'Caption'#6#12'State Index:'#5'Color'#7#6'clNone'#12'FocusContro'
+'l'#7#13'edtIndexState'#11'ParentColor'#8#4'Left'#2#8#6'Height'#2#14#3'Top'#2
+'n'#5'Width'#2'>'#0#0#5'TEdit'#7'edtText'#8'OnChange'#7#11'Edit1Change'#8'Ta'
+'bOrder'#2#0#4'Left'#2'V'#6'Height'#2#23#3'Top'#2#4#5'Width'#2'['#0#0#5'TEdi'
+'t'#11'edtIndexImg'#13'OnEditingDone'#7#24'edtIndexStateEditingDone'#8'TabOr'
+'der'#2#1#4'Left'#2'V'#6'Height'#2#23#3'Top'#2'&'#5'Width'#2'0'#0#0#5'TEdit'
+#11'edtIndexSel'#13'OnEditingDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'
+#2#2#4'Left'#2'V'#6'Height'#2#23#3'Top'#2'H'#5'Width'#2'0'#0#0#5'TEdit'#13'e'
+'dtIndexState'#13'OnEditingDone'#7#24'edtIndexStateEditingDone'#8'TabOrder'#2
+#3#4'Left'#2'V'#6'Height'#2#23#3'Top'#2'h'#5'Width'#2'0'#0#0#0#11'TOpenDialo'
+'g'#11'OpenDialog1'#5'Title'#6#4'Open'#11'FilterIndex'#2#0#5'Title'#6#4'Open'
+#4'left'#3#176#0#3'top'#3'8'#1#0#0#11'TSaveDialog'#11'SaveDialog1'#5'Title'#6
+#4'Save'#11'FilterIndex'#2#0#5'Title'#6#4'Save'#4'left'#3#176#0#3'top'#3'['#1
,#0#0#0
]);

View File

@ -115,7 +115,9 @@ begin
TreeView1.Selected := TreeView1.Items.Add(TreeView1.Selected, S)
else
TreeView1.Selected := TreeView1.Items.AddChild(TreeView1.Selected, S);
GroupBox2.Enabled := TreeView1.Items.Count > 0;
edtText.SetFocus;
edtText.SelectAll;
end;
@ -184,13 +186,19 @@ begin
if TempNode <> nil then
TreeView1.Selected := TempNode;
GroupBox2.Enabled := TreeView1.Items.Count > 0;
TreeView1.SetFocus;
end;
end;
procedure TTreeViewItemsEditorForm.btnLoadClick(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
TreeView1.LoadFromFile(OpenDialog1.FileName);
GroupBox2.Enabled := TreeView1.Items.Count > 0;
end;
end;
procedure TTreeViewItemsEditorForm.btnSaveClick(Sender: TObject);
@ -214,7 +222,18 @@ begin
end;
procedure TTreeViewItemsEditorForm.LoadFromTree(ATreeView: TTreeView);
var
begin
FTreeView := ATreeView;
if Assigned(ATreeView) then
begin
TreeView1.Images := ATreeView.Images;
TreeView1.StateImages := ATreeView.StateImages;
TreeView1.Items.Assign(ATreeView.Items);
end;
GroupBox2.Enabled := TreeView1.Items.Count > 0;
end;
(*var
S:TMemoryStream;
begin
FTreeView:=ATreeView;
@ -231,10 +250,17 @@ begin
S.Free;
end;
end;
end;
end;*)
procedure TTreeViewItemsEditorForm.SaveToTree;
var
begin
if Assigned(FTreeView) then
begin
FTreeView.Items.Assign(TreeView1.Items);
FModified := True;
end;
end;
(*var
S:TMemoryStream;
begin
if Assigned(FTreeView) then
@ -249,7 +275,7 @@ begin
S.Free;
end;
end
end;
end;*)
{ TTreeViewItemsProperty }
@ -297,5 +323,7 @@ initialization
RegisterPropertyEditor(ClassTypeInfo(TTreeNodes), TTreeView, 'Items', TTreeViewItemsProperty);
RegisterComponentEditor(TTreeView,TTreeViewComponentEditor);
end.