LCL: Use SpinEdit controls for ImageIndex selection in TreeView component editor. Issue #40748. Part of patch by n7800

This commit is contained in:
wp_xyz 2024-02-17 23:10:26 +01:00
parent 37315271a4
commit 1339ae70e9
24 changed files with 370 additions and 79 deletions

View File

@ -1786,6 +1786,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Propietats de l'Element"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1727,6 +1727,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Vlastnosti položky"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-04-06 00:06+0200\n"
"PO-Revision-Date: 2024-02-17 23:09+0100\n"
"Last-Translator: Swen Heinig <swen@heinig.email>\n"
"Language-Team: Deutsch <lazarus@miraclec.com>\n"
"Language: de\n"
@ -10,7 +10,7 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Generator: Poedit 3.0.1\n"
"X-Generator: Poedit 3.4.1\n"
#: objinspstrconsts.cactionlisteditorallcategory
msgid "(All)"
@ -1727,6 +1727,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Eigenschaften des Eintrags"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr "%s nicht zugewiesen."
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr "%s enthält nur %d Bilder."
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"
@ -1834,4 +1844,3 @@ msgstr "Tab nach links bewegen"
#: objinspstrconsts.tccesmovetabright
msgid "Move tab right"
msgstr "Tab nach rechts bewegen"

View File

@ -1728,6 +1728,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Propiedades del elemento"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1719,6 +1719,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Kohtien ominaisuudet"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1723,6 +1723,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Propriétés des éléments"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1797,6 +1797,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "תכונות פריט"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1726,6 +1726,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Elem tulajdonságai"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1800,6 +1800,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Properti Item"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1729,6 +1729,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Proprietà delle voci"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1734,6 +1734,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "項目のプロパティ"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1727,6 +1727,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Elemento savybės"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1784,6 +1784,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Onderdeel properties"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1721,6 +1721,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Właściwości elementu"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1711,6 +1711,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr ""
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1720,6 +1720,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Propriedades Itens"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1720,6 +1720,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Свойства элемента"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1734,6 +1734,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Vlastnosti položiek"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1720,6 +1720,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Öğe Özellikleri"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1723,6 +1723,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "Властивості елемента"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -1723,6 +1723,16 @@ msgctxt "objinspstrconsts.sccstredtgrprcaption"
msgid "Item Properties"
msgstr "项目属性"
#: objinspstrconsts.sccstredtimagelistnotassigned
#, object-pascal-format
msgid "%s not assigned."
msgstr ""
#: objinspstrconsts.sccstredtinvalidindex
#, object-pascal-format
msgid "%s has only %d images."
msgstr ""
#: objinspstrconsts.sccstredtitem
msgctxt "objinspstrconsts.sccstredtitem"
msgid "Item"

View File

@ -113,6 +113,9 @@ resourcestring
sccsTrEdtOpenDialog = 'Open';
sccsTrEdtSaveDialog = 'Save';
sccsTrEdtInvalidIndex = '%s has only %d images.';
sccsTrEdtImageListNotAssigned = '%s not assigned.';
// ListView Items Editor
sccsLvEdtCaption = 'ListView Items Editor';
sccsLvEdt = 'Edit Items ...';

View File

@ -10,22 +10,22 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
ClientWidth = 635
Constraints.MinHeight = 240
Constraints.MinWidth = 400
Position = poScreenCenter
LCLVersion = '3.99.0.0'
OnClose = FormClose
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.9.0.0'
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideBottom.Control = BtnOK
Left = 6
Height = 276
Height = 277
Top = 6
Width = 420
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'Items'
ClientHeight = 249
ClientHeight = 257
ClientWidth = 416
TabOrder = 0
object TreeView1: TTreeView
@ -34,7 +34,7 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
AnchorSideBottom.Control = GroupBox1
AnchorSideBottom.Side = asrBottom
Left = 5
Height = 239
Height = 247
Top = 5
Width = 240
Anchors = [akTop, akLeft, akRight, akBottom]
@ -44,8 +44,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
HideSelection = False
ReadOnly = True
TabOrder = 0
OnSelectionChanged = TreeView1SelectionChanged
Options = [tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
OnSelectionChanged = TreeView1SelectionChanged
end
object BtnNewItem: TButton
Tag = 1
@ -63,8 +63,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
BorderSpacing.Around = 6
Caption = '&New Item'
Default = True
OnClick = BtnNewItemClick
TabOrder = 1
OnClick = BtnNewItemClick
end
object BtnNewSubItem: TButton
AnchorSideLeft.Control = BtnNewItem
@ -79,8 +79,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Caption = 'N&ew SubItem'
OnClick = BtnNewItemClick
TabOrder = 2
OnClick = BtnNewItemClick
end
object BtnDelete: TButton
AnchorSideLeft.Control = BtnNewSubItem
@ -95,8 +95,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Caption = '&Delete'
OnClick = btnDeleteClick
TabOrder = 3
OnClick = btnDeleteClick
end
object BtnLoad: TButton
AnchorSideLeft.Control = BtnDelete
@ -111,8 +111,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Caption = '&Load'
OnClick = btnLoadClick
TabOrder = 4
OnClick = btnLoadClick
end
object BtnSave: TButton
AnchorSideLeft.Control = BtnLoad
@ -127,8 +127,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Caption = '&Save'
OnClick = btnSaveClick
TabOrder = 5
OnClick = btnSaveClick
end
object MoveUpBtn: TSpeedButton
AnchorSideLeft.Control = TreeView1
@ -141,9 +141,9 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Width = 22
BorderSpacing.Around = 6
Enabled = False
OnClick = MoveUpBtnClick
ShowHint = True
ParentShowHint = False
OnClick = MoveUpBtnClick
end
object MoveDownBtn: TSpeedButton
AnchorSideLeft.Control = MoveUpBtn
@ -155,9 +155,9 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Width = 22
BorderSpacing.Top = 7
Enabled = False
OnClick = MoveDownBtnClick
ShowHint = True
ParentShowHint = False
OnClick = MoveDownBtnClick
end
end
object GroupBox2: TGroupBox
@ -168,13 +168,13 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BtnOK
Left = 432
Height = 276
Height = 277
Top = 6
Width = 197
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'Item Properties'
ClientHeight = 249
ClientHeight = 257
ClientWidth = 193
TabOrder = 1
object LabelText: TLabel
@ -183,7 +183,7 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Left = 6
Height = 15
Top = 6
Width = 29
Width = 24
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'Text:'
@ -196,37 +196,34 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
AnchorSideTop.Side = asrBottom
Left = 6
Height = 15
Top = 58
Width = 79
Top = 52
Width = 68
BorderSpacing.Top = 6
Caption = 'Image Index:'
FocusControl = edtIndexImg
ParentColor = False
end
object LabelSelectedIndex: TLabel
AnchorSideLeft.Control = LabelImageIndex
AnchorSideTop.Control = edtIndexImg
AnchorSideTop.Control = spnImageIndex
AnchorSideTop.Side = asrBottom
Left = 6
Height = 15
Top = 110
Width = 93
Top = 98
Width = 79
BorderSpacing.Top = 6
Caption = 'Selected index:'
FocusControl = edtIndexSel
ParentColor = False
end
object LabelStateIndex: TLabel
AnchorSideLeft.Control = LabelSelectedIndex
AnchorSideTop.Control = edtIndexSel
AnchorSideTop.Control = spnSelectedIndex
AnchorSideTop.Side = asrBottom
Left = 6
Height = 15
Top = 162
Width = 73
Top = 144
Width = 61
BorderSpacing.Top = 6
Caption = 'State Index:'
FocusControl = edtIndexState
ParentColor = False
end
object edtText: TEdit
@ -236,59 +233,71 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
AnchorSideRight.Control = GroupBox2
AnchorSideRight.Side = asrBottom
Left = 6
Height = 29
Height = 23
Top = 23
Width = 182
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
BorderSpacing.Right = 5
OnChange = Edit1Change
TabOrder = 0
OnChange = Edit1Change
end
object edtIndexImg: TEdit
object spnImageIndex: TSpinEdit
AnchorSideLeft.Control = LabelImageIndex
AnchorSideTop.Control = LabelImageIndex
AnchorSideTop.Side = asrBottom
Left = 6
Height = 29
Top = 75
Width = 48
Height = 23
Top = 69
Width = 66
Alignment = taRightJustify
BorderSpacing.Top = 2
OnEditingDone = edtIndexStateEditingDone
MaxValue = 99999
MinValue = -1
TabOrder = 1
Value = -1
OnChange = spnIndexChange
end
object edtIndexSel: TEdit
object spnSelectedIndex: TSpinEdit
AnchorSideLeft.Control = LabelSelectedIndex
AnchorSideTop.Control = LabelSelectedIndex
AnchorSideTop.Side = asrBottom
Left = 6
Height = 29
Top = 127
Width = 48
Height = 23
Top = 115
Width = 66
Alignment = taRightJustify
BorderSpacing.Top = 2
OnEditingDone = edtIndexStateEditingDone
MaxValue = 99999
MinValue = -1
TabOrder = 2
Value = -1
OnChange = spnIndexChange
end
object edtIndexState: TEdit
object spnStateIndex: TSpinEdit
AnchorSideLeft.Control = LabelStateIndex
AnchorSideTop.Control = LabelStateIndex
AnchorSideTop.Side = asrBottom
Left = 6
Height = 29
Top = 179
Width = 48
Height = 23
Top = 161
Width = 66
Alignment = taRightJustify
BorderSpacing.Top = 2
OnEditingDone = edtIndexStateEditingDone
MaxValue = 99999
MinValue = -1
TabOrder = 3
Value = -1
OnChange = spnIndexChange
end
end
object BtnOK: TBitBtn
AnchorSideRight.Control = BtnCancel
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 303
Height = 27
Top = 288
Left = 304
Height = 26
Top = 289
Width = 75
Anchors = [akRight, akBottom]
AutoSize = True
@ -304,10 +313,10 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
AnchorSideRight.Control = BtnApply
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 384
Height = 27
Top = 288
Width = 83
Left = 385
Height = 26
Top = 289
Width = 82
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Around = 6
@ -324,8 +333,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 473
Height = 26
Top = 289
Height = 25
Top = 290
Width = 75
Anchors = [akRight, akBottom]
AutoSize = True
@ -333,8 +342,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
Caption = '&Apply'
Constraints.MinHeight = 25
Constraints.MinWidth = 75
OnClick = btnApplyClick
TabOrder = 4
OnClick = btnApplyClick
end
object BtnHelp: TBitBtn
AnchorSideRight.Control = Owner
@ -342,8 +351,8 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 554
Height = 27
Top = 288
Height = 26
Top = 289
Width = 75
Anchors = [akRight, akBottom]
AutoSize = True
@ -357,13 +366,13 @@ object TreeViewItemsEditorForm: TTreeViewItemsEditorForm
object OpenDialog1: TOpenDialog
Title = 'Open'
FilterIndex = 0
left = 296
top = 208
Left = 296
Top = 208
end
object SaveDialog1: TSaveDialog
Title = 'Save'
FilterIndex = 0
left = 368
top = 232
Left = 368
Top = 232
end
end

View File

@ -20,7 +20,7 @@ interface
uses
Classes, SysUtils,
// LCL
Forms, Dialogs, Buttons, Controls, StdCtrls, ComCtrls,
Forms, Dialogs, Buttons, Controls, StdCtrls, ComCtrls, ImgList, Spin,
// IdeIntf
PropEdits, ComponentEditors, ObjInspStrConsts, IDEImagesIntf, IDEWindowIntf;
@ -39,9 +39,6 @@ type
BtnDelete: TButton;
BtnLoad: TButton;
edtText: TEdit;
edtIndexImg: TEdit;
edtIndexSel: TEdit;
edtIndexState: TEdit;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
LabelText: TLabel;
@ -52,6 +49,9 @@ type
MoveDownBtn: TSpeedButton;
MoveUpBtn: TSpeedButton;
SaveDialog1: TSaveDialog;
spnImageIndex: TSpinEdit;
spnSelectedIndex: TSpinEdit;
spnStateIndex: TSpinEdit;
TreeView1: TTreeView;
procedure BtnNewItemClick(Sender: TObject);
procedure Edit1Change(Sender: TObject);
@ -64,13 +64,14 @@ type
procedure btnDeleteClick(Sender: TObject);
procedure btnLoadClick(Sender: TObject);
procedure btnSaveClick(Sender: TObject);
procedure edtIndexStateEditingDone(Sender: TObject);
procedure spnIndexChange(Sender: TObject);
private
FTreeView: TCustomTreeView;
FModified: Boolean;
procedure LoadFromTree(ATreeView: TCustomTreeView);
procedure SaveToTree;
procedure UpdateEnabledStates;
procedure UpdateImageHints;
public
end;
@ -191,10 +192,27 @@ procedure TTreeViewItemsEditorForm.TreeView1SelectionChanged(Sender: TObject);
begin
if Assigned(TreeView1.Selected) then
begin
// Update node text
edtText.Text := TreeView1.Selected.Text;
edtIndexImg.Text := IntToStr(TreeView1.Selected.ImageIndex);
edtIndexSel.Text := IntToStr(TreeView1.Selected.SelectedIndex);
edtIndexState.Text := IntToStr(TreeView1.Selected.StateIndex);
// Update image indexes
// Remove events to avoid cyclic calling
spnImageIndex.OnChange := nil;
spnSelectedIndex.OnChange := nil;
spnStateIndex.OnChange := nil;
try
// Read the indexes of the selected item
spnImageIndex.Value := TreeView1.Selected.ImageIndex;
spnSelectedIndex.Value := TreeView1.Selected.SelectedIndex;
spnStateIndex.Value := TreeView1.Selected.StateIndex;
finally
// Restore events
spnImageIndex.OnChange := @spnIndexChange;
spnSelectedIndex.OnChange := @spnIndexChange;
spnStateIndex.OnChange := @spnIndexChange;
end;
// Update hints
UpdateImageHints;
end;
UpdateEnabledStates;
end;
@ -238,17 +256,69 @@ begin
TreeView1.SaveToFile(SaveDialog1.FileName);
end;
procedure TTreeViewItemsEditorForm.edtIndexStateEditingDone(Sender: TObject);
procedure TTreeViewItemsEditorForm.spnIndexChange(Sender: TObject);
begin
if Assigned(TreeView1.Selected) then
begin
TreeView1.Selected.ImageIndex := StrToIntDef(edtIndexImg.Text, -1);
TreeView1.Selected.SelectedIndex := StrToIntDef(edtIndexSel.Text, -1);
TreeView1.Selected.StateIndex := StrToIntDef(edtIndexState.Text, -1);
edtIndexImg.Text := IntToStr(TreeView1.Selected.ImageIndex);
edtIndexSel.Text := IntToStr(TreeView1.Selected.SelectedIndex);
edtIndexState.Text := IntToStr(TreeView1.Selected.StateIndex);
TreeView1.Selected.ImageIndex := spnImageIndex.Value;
TreeView1.Selected.SelectedIndex := spnSelectedIndex.Value;
TreeView1.Selected.StateIndex := spnStateIndex.Value;
UpdateImageHints;
end;
end;
// Show hints and "*" in label for invalid index
procedure TTreeViewItemsEditorForm.UpdateImageHints;
procedure UpdateImageHint(ASpinEdit: TSpinEdit;
AIsStateImages: boolean; ALabel: TLabel; ACaption: string);
var
lImageList: TCustomImageList;
lPropName: string;
begin
if AIsStateImages then
begin
lImageList := TreeView1.StateImages;
lPropName := FTreeView.Name + '.StateImages';
end else begin
lImageList := TreeView1.Images;
lPropName := FTreeView.Name + '.Images';
end;
// check valid index
if ASpinEdit.Value >= 0 then
begin
// check assign
if lImageList = nil then
begin
ALabel.Hint := Format(sccsTrEdtImageListNotAssigned, [lPropName]);
ALabel.ShowHint := true;
end else begin
// check count
if ASpinEdit.Value >= lImageList.Count then
begin
ALabel.Hint := Format(sccsTrEdtInvalidIndex, [lPropName, lImageList.Count]);
ALabel.ShowHint := true;
end else
ALabel.ShowHint := false;
end;
end else
aLabel.ShowHint := false;
// show asterisk if necessary
if ALabel.ShowHint then
ALabel.Caption := ACaption + '*:'
else
ALabel.Caption := ACaption + ':';
end;
//
begin
if Assigned(TreeView1.Selected) then
begin
UpdateImageHint(spnImageIndex, false, LabelImageIndex, sccsTrEdtLabelImageIndex);
UpdateImageHint(spnSelectedIndex, false, LabelSelectedIndex, sccsTrEdtLabelSelIndex);
UpdateImageHint(spnStateIndex, true, LabelStateIndex, sccsTrEdtLabelStateIndex);
end;
end;