Changeset 4 for trunk/Forms


Ignore:
Timestamp:
Jun 3, 2010, 5:25:10 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Knihovna pro uchování stavu rozevření stromu.
  • Přidáno: Ikonky stromu skupin.
Location:
trunk/Forms
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UItemEdit.lfm

    r3 r4  
    44  Top = 175
    55  Width = 558
     6  ActiveControl = Panel1
    67  Caption = 'ItemEditForm'
    78  ClientHeight = 429
  • trunk/Forms/UItemEdit.pas

    r3 r4  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    9   StdCtrls, USqlDatabase;
     9  StdCtrls, Spin, EditBtn, USqlDatabase;
    1010
    1111type
     
    7070  Column: Integer;
    7171  ObjectInfo: TDbRows;
     72  ValueType: Integer;
    7273const
    7374  ColumnCount = 2;
     
    9596      TLabel(NewControl).Caption := Properties[I].Values['Name'] + ':';
    9697
    97       NewControl := TEdit.Create(Panel1);
    98       NewControl.Parent := Panel1;
    99       NewControl.Top := LastTop;
    100       NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2;
    101       TEdit(NewControl).Text := Values[0].Values[Properties[I].Values['ColumnName']];
    102       TEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20;
     98      ValueType := StrToInt(Properties[I].Values['Type']);
     99      if ValueType = Integer(vtInteger) then begin
     100        NewControl := TSpinEdit.Create(Panel1);
     101        NewControl.Parent := Panel1;
     102        NewControl.Top := LastTop;
     103        NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2;
     104        TSpinEdit(NewControl).Value := StrToInt(Values[0].Values[Properties[I].Values['ColumnName']]);
     105        TSpinEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20;
     106      end else
     107      if ValueType = Integer(vtDate) then begin
     108        NewControl := TDateEdit.Create(Panel1);
     109        NewControl.Parent := Panel1;
     110        NewControl.Top := LastTop;
     111        NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2;
     112        TDateEdit(NewControl).Date := StrToDate(Values[0].Values[Properties[I].Values['ColumnName']]);
     113        TDateEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20;
     114      end else
     115      if ValueType = Integer(vtFloat) then begin
     116        NewControl := TFloatSpinEdit.Create(Panel1);
     117        NewControl.Parent := Panel1;
     118        NewControl.Top := LastTop;
     119        NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2;
     120        TFloatSpinEdit(NewControl).Value := StrToFloat(Values[0].Values[Properties[I].Values['ColumnName']]);
     121        TFloatSpinEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20;
     122      end else
     123      if ValueType = Integer(vtString) then begin
     124        NewControl := TEdit.Create(Panel1);
     125        NewControl.Parent := Panel1;
     126        NewControl.Top := LastTop;
     127        NewControl.Left := Column * Width div ColumnCount + (Width div ColumnCount) div 2;
     128        TEdit(NewControl).Text := Values[0].Values[Properties[I].Values['ColumnName']];
     129        TEdit(NewControl).Width := (Width div ColumnCount) div 2 - 20;
     130      end;
    103131
    104132      Column := (Column + 1) mod 2;
  • trunk/Forms/UMainForm.lfm

    r3 r4  
    11object MainForm: TMainForm
    2   Left = 359
     2  Left = 317
    33  Height = 445
    4   Top = 124
     4  Top = 97
    55  Width = 649
    6   ActiveControl = ListView1
    76  Caption = 'ChronIS'
    87  ClientHeight = 445
     
    109  OnClose = FormClose
    1110  OnCreate = FormCreate
     11  OnDestroy = FormDestroy
    1212  OnShow = FormShow
    1313  LCLVersion = '0.9.29'
    14   object TreeView1: TTreeView
    15     Left = 8
    16     Height = 419
    17     Top = 19
    18     Width = 171
    19     Anchors = [akTop, akLeft, akBottom]
    20     DefaultItemHeight = 15
    21     ReadOnly = True
     14  object Panel1: TPanel
     15    Left = 0
     16    Height = 445
     17    Top = 0
     18    Width = 184
     19    Align = alLeft
     20    BevelOuter = bvNone
     21    ClientHeight = 445
     22    ClientWidth = 184
    2223    TabOrder = 0
    23     OnChange = TreeView1Change
    24     Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
    25   end
    26   object ListView1: TListView
     24    object Label1: TLabel
     25      Left = 7
     26      Height = 14
     27      Top = 4
     28      Width = 47
     29      Caption = 'Skupiny:'
     30      ParentColor = False
     31    end
     32    object TreeView1: TTreeView
     33      Left = 8
     34      Height = 413
     35      Top = 19
     36      Width = 176
     37      Anchors = [akTop, akLeft, akRight, akBottom]
     38      DefaultItemHeight = 16
     39      Images = ImageListActions
     40      ReadOnly = True
     41      TabOrder = 0
     42      OnChange = TreeView1Change
     43      Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
     44    end
     45  end
     46  object Panel2: TPanel
     47    Left = 189
     48    Height = 445
     49    Top = 0
     50    Width = 460
     51    Align = alClient
     52    BevelOuter = bvNone
     53    ClientHeight = 445
     54    ClientWidth = 460
     55    TabOrder = 1
     56    object Label2: TLabel
     57      Left = 11
     58      Height = 14
     59      Top = 4
     60      Width = 38
     61      Caption = 'Výpisy:'
     62      ParentColor = False
     63    end
     64    object ListView1: TListView
     65      Left = 3
     66      Height = 389
     67      Top = 19
     68      Width = 450
     69      Anchors = [akTop, akLeft, akRight, akBottom]
     70      Columns = <>
     71      ItemIndex = -1
     72      PopupMenu = PopupMenuItem
     73      ReadOnly = True
     74      RowSelect = True
     75      TabOrder = 0
     76      ViewStyle = vsReport
     77      OnDblClick = ListView1DblClick
     78      OnKeyPress = ListView1KeyPress
     79      OnResize = ListView1Resize
     80      OnSelectItem = ListView1SelectItem
     81    end
     82    object ButtonAdd: TButton
     83      Left = 3
     84      Height = 25
     85      Top = 416
     86      Width = 75
     87      Action = AItemAdd
     88      Anchors = [akLeft, akBottom]
     89      TabOrder = 1
     90    end
     91    object ButtonRemove: TButton
     92      Left = 83
     93      Height = 25
     94      Top = 416
     95      Width = 75
     96      Action = AItemDelete
     97      Anchors = [akLeft, akBottom]
     98      TabOrder = 2
     99    end
     100  end
     101  object Splitter1: TSplitter
    27102    Left = 184
    28     Height = 417
    29     Top = 16
    30     Width = 453
    31     Anchors = [akTop, akLeft, akRight, akBottom]
    32     Columns = <>
    33     ItemIndex = -1
    34     ReadOnly = True
    35     RowSelect = True
    36     TabOrder = 1
    37     ViewStyle = vsReport
    38     OnDblClick = ListView1DblClick
    39     OnKeyPress = ListView1KeyPress
    40     OnResize = ListView1Resize
    41     OnSelectItem = ListView1SelectItem
    42   end
    43   object Label1: TLabel
    44     Left = 7
    45     Height = 14
    46     Top = 4
    47     Width = 47
    48     Caption = 'Skupiny:'
    49     ParentColor = False
    50   end
    51   object Label2: TLabel
    52     Left = 187
    53     Height = 14
    54     Top = 4
    55     Width = 38
    56     Caption = 'Výpisy:'
    57     ParentColor = False
     103    Height = 445
     104    Top = 0
     105    Width = 5
     106  end
     107  object ActionListItem: TActionList
     108    Images = ImageListActions
     109    left = 360
     110    top = 120
     111    object AItemDelete: TAction
     112      Category = 'Object'
     113      Caption = 'Smazat'
     114    end
     115    object AItemAdd: TAction
     116      Category = 'Object'
     117      Caption = 'Přidat'
     118      OnExecute = AItemAddExecute
     119    end
     120    object AItemEdit: TAction
     121      Category = 'Object'
     122      Caption = 'Upravit'
     123      OnExecute = AItemEditExecute
     124    end
     125    object AItemView: TAction
     126      Category = 'Object'
     127      Caption = 'Zobrazit'
     128      OnExecute = AItemViewExecute
     129    end
     130    object AObjectGroupDelete: TAction
     131      Category = 'ObjectGroup'
     132      Caption = 'Odebrat'
     133    end
     134    object AObjectGroupAddGroup: TAction
     135      Category = 'ObjectGroup'
     136      Caption = 'Přidat skupinu'
     137      OnExecute = AObjectGroupAddGroupExecute
     138    end
     139    object AObjectGroupAddObject: TAction
     140      Category = 'ObjectGroup'
     141      Caption = 'Přidat objekt'
     142    end
     143    object AObjectGroupEdit: TAction
     144      Category = 'ObjectGroup'
     145      Caption = 'Upravit'
     146    end
     147  end
     148  object PopupMenuItem: TPopupMenu
     149    Images = ImageListActions
     150    left = 256
     151    top = 120
     152    object MenuItem1: TMenuItem
     153      Action = AItemView
     154      Default = True
     155      OnClick = AItemViewExecute
     156    end
     157    object MenuItem4: TMenuItem
     158      Action = AItemEdit
     159      OnClick = AItemEditExecute
     160    end
     161    object MenuItem3: TMenuItem
     162      Action = AItemDelete
     163    end
     164    object MenuItem2: TMenuItem
     165      Action = AItemAdd
     166    end
     167  end
     168  object PopupMenuObject: TPopupMenu
     169    Images = ImageListActions
     170    left = 72
     171    top = 136
     172  end
     173  object PopupMenuObjectGroup: TPopupMenu
     174    Images = ImageListActions
     175    left = 72
     176    top = 88
     177    object MenuItem5: TMenuItem
     178      Action = AObjectGroupAddGroup
     179    end
     180    object MenuItem7: TMenuItem
     181      Action = AObjectGroupAddObject
     182    end
     183    object MenuItem8: TMenuItem
     184      Action = AObjectGroupEdit
     185    end
     186    object MenuItem6: TMenuItem
     187      Action = AObjectGroupDelete
     188    end
     189  end
     190  object ImageListActions: TImageList
     191    left = 256
     192    top = 56
     193    Bitmap = {
     194      4C69020000001000000010000000000000000000000000000000000000000000
     195      0000000000000000000000000000000000000000000000000000000000000000
     196      000000000000000000000000000000000000000000000000000000000000F4F9
     197      FFFF4195EFFF2F8AF1FF2F8DF3FF2F8DF3FF2F8DF3FF2F8BF1FF2F8BEFFFE9F2
     198      FEFF00000000000000000000000000000000000000000000000000000000F0F6
     199      FEFF239AFCFF21CFFFFF24CCFFFF24CCFFFF24CCFFFF23D1FFFF1C9FFFFFE2EE
     200      FDFF00000000000000000000000000000000000000000000000000000000F1F7
     201      FEFF32A2FBFF36DBFFFF39D8FFFF39D8FFFF39D8FFFF3ADEFFFF26A5FFFFE3EE
     202      FDFF00000000000000000000000000000000000000000000000000000000F0F6
     203      FEFF3CABFCFF58F6FFFF59F1FFFF58F1FFFF59F1FFFF5CF9FFFF35B2FFFFE2ED
     204      FDFF00000000000000000000000000000000000000000000000000000000F1F7
     205      FFFF2F9AF6FF3ECBFFFF3BC7FFFF36C5FFFF3BC6FFFF40CEFFFF299EF9FFE4EF
     206      FEFF00000000000000000000000000000000000000000000000000000000FEFE
     207      FEFFB8D3F4FFA9BFEFFF9FC0EEFF567BACFF91B9EAFFA9BFEFFFADCCF3FFFCFC
     208      FDFF000000000000000000000000000000000000000000000000FFFFFFFFFAFA
     209      FAFFFDFDFDFFFDFDFDFFF5F5F6FF9F978EFFE9EAEAFFFDFDFDFFFDFDFDFFFAFA
     210      FAFFFEFEFEFF0000000000000000000000000000000000000000EDF2F8FF7A7E
     211      83FF979694FF9A9896FF8D8D8FFF7E7F80FF8F8E8AFF999796FF989795FF8282
     212      7DFFE9EBE9FF000000000000000000000000FFF3DCFFFFEED0FFE7D2AEFFC0AB
     213      88FFFAECD3FFFBEDD5FFFCFAF6FF00000000F9F9FBFFD8D7EDFFD5D4EBFF9492
     214      B8FFA4A4C7FFD3D2EEFFDADAF1FF00000000FCB02CFFFFBC35FFFFB72BFFFFB8
     215      2DFFFFC035FFFFB726FFFFE2A5FF00000000C2C2EBFF000FC6FF0013D6FF0005
     216      CCFF0004C9FF0021D9FF0C20C0FF00000000FEB12FFFFFDA6AFFFFD862FFFFD8
     217      64FFFFDA69FFFFC748FFFFD9A6FF00000000C3C3E7FF001CE2FF003AFFFF003F
     218      FFFF003BFFFF0034FFFF1018CCFF00000000FFB93BFFFFEB89FFFFE782FFFFE7
     219      82FFFFEB88FFFFD561FFFFDAA6FF00000000C3C3E7FF0029E2FF0B5DFFFF0E61
     220      FFFF0B5CFFFF044CFFFF111CCDFF00000000FFC34CFFFFFFCEFFFFFFC3FFFFFF
     221      C3FFFFFFCBFFFFF094FFFFD8A4FF00000000C2C2E7FF003EE9FF1E8CFFFF2190
     222      FFFF1D88FFFF136FFFFF0D23CFFF00000000FBB73DFFFFCE5BFFFFCB58FFFFCB
     223      58FFFFCD5AFFFFC044FFFFE0ACFF00000000C7C7EBFF1123C2FF1143D3FF1149
     224      D6FF1143D1FF1133D2FF2121B5FF000000000000000000000000000000000000
     225      0000000000000000000000000000000000000000000000000000000000000000
     226      0000000000000000000000000000000000000000000000000000000000000000
     227      0000000000000000000000000000000000000000000000000000000000000000
     228      0000000000000000000000000000000000000000000000000000000000000000
     229      0000000000000000000000000000000000000000000000000000000000000000
     230      0000000000000000000000000000000000000000000000000000000000000000
     231      0000C0C0C0FFC0C0C0FF808080FF808080FF808080FF808080FF808080FF8080
     232      80FF808080FF000000000000000000000000000000000000000000000000C0C0
     233      C0FFC0C0C0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8080
     234      80FF808080FF0000000000000000000000000000000000000000C0C0C0FFFFFF
     235      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF808080FFC0C0
     236      C0FF000000FF00000000000000000000000000000000808080FFFFFFFFFFFFFF
     237      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF808080FFC0C0C0FFC0C0
     238      C0FF000000FF00000000000000000000000000000000808080FF808080FF8080
     239      80FF808080FF808080FF808080FF808080FF808080FFC0C0C0FFC0C0C0FF8080
     240      80FF000000FF00000000000000000000000000000000808080FFFFFFFFFFFFFF
     241      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF808080FFC0C0C0FFC0C0C0FF8080
     242      80FF000000FF00000000000000000000000000000000808080FFFFFFFFFFFFFF
     243      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF808080FFC0C0C0FFC0C0C0FF8080
     244      80FF000000FF00000000000000000000000000000000808080FFFFFFFFFFFFFF
     245      FFFFFFFFFFFFFFFFFFFFFFFFFFFFC0C0C0FF000000FFC0C0C0FF808080FFC0C0
     246      C0FF000000FF00000000000000000000000000000000808080FFFFFFFFFFFFFF
     247      FFFFFFFFFFFFFFFFFFFFC0C0C0FFFFFFFFFF000000FFC0C0C0FF808080FF0000
     248      00FF808080FFC0C0C0FF000000000000000000000000808080FFFFFFFFFFFFFF
     249      FFFFFFFFFFFFC0C0C0FFFFFFFFFFC0C0C0FF000000FFC0C0C0FF000000FF8080
     250      80FFC0C0C0FFC0C0C0FF000000000000000000000000808080FFFFFFFFFFFFFF
     251      FFFFC0C0C0FFFFFFFFFFC0C0C0FFFFFFFFFF000000FF000000FF808080FFC0C0
     252      C0FFC0C0C0FF00000000000000000000000000000000808080FF808080FF8080
     253      80FF000000FF000000FF000000FF000000FF000000FF808080FFC0C0C0FF0000
     254      0000000000000000000000000000000000000000000000000000000000000000
     255      0000000000000000000000000000000000000000000000000000000000000000
     256      0000000000000000000000000000000000000000000000000000000000000000
     257      0000000000000000000000000000000000000000000000000000000000000000
     258      0000000000000000000000000000
     259    }
    58260  end
    59261end
  • trunk/Forms/UMainForm.pas

    r3 r4  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   StdCtrls, USqlDatabase, DOM, XMLRead, XMLWrite, UPersistentForm, UItemView;
     9  StdCtrls, ActnList, Menus, ExtCtrls, USqlDatabase, DOM, XMLRead, XMLWrite,
     10  UPersistentForm, UTreeState;
    1011
    1112const
     
    1314
    1415type
     16  TValueType = (vtNone, vtInteger, vtString, vtText, vtDateTime, vtFloat, vtImage, vtBoolean,
     17  vtIPv4, vtMAC, vtIPv6, vtFile, vtGPS, vtEnumeration, vtHyperlink, vtPassword,
     18  vtReference, vtDate, vtTime, vtColor);
    1519
    1620  { TMainForm }
    1721
    1822  TMainForm = class(TForm)
     23    AObjectGroupEdit: TAction;
     24    AObjectGroupAddObject: TAction;
     25    AObjectGroupAddGroup: TAction;
     26    AObjectGroupDelete: TAction;
     27    AItemView: TAction;
     28    AItemEdit: TAction;
     29    AItemAdd: TAction;
     30    AItemDelete: TAction;
     31    ActionListItem: TActionList;
     32    ButtonAdd: TButton;
     33    ButtonRemove: TButton;
     34    ImageListActions: TImageList;
    1935    Label1: TLabel;
    2036    Label2: TLabel;
    2137    ListView1: TListView;
     38    MenuItem1: TMenuItem;
     39    MenuItem2: TMenuItem;
     40    MenuItem3: TMenuItem;
     41    MenuItem4: TMenuItem;
     42    MenuItem5: TMenuItem;
     43    MenuItem6: TMenuItem;
     44    MenuItem7: TMenuItem;
     45    MenuItem8: TMenuItem;
     46    Panel1: TPanel;
     47    Panel2: TPanel;
     48    PopupMenuObjectGroup: TPopupMenu;
     49    PopupMenuObject: TPopupMenu;
     50    PopupMenuItem: TPopupMenu;
     51    Splitter1: TSplitter;
    2252    TreeView1: TTreeView;
     53    procedure AItemAddExecute(Sender: TObject);
     54    procedure AItemEditExecute(Sender: TObject);
     55    procedure AItemViewExecute(Sender: TObject);
     56    procedure AObjectGroupAddGroupExecute(Sender: TObject);
     57    procedure ButtonAddClick(Sender: TObject);
    2358    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2459    procedure FormCreate(Sender: TObject);
     60    procedure FormDestroy(Sender: TObject);
    2561    procedure FormShow(Sender: TObject);
    2662    procedure ListView1DblClick(Sender: TObject);
     
    3773    PersistentForm: TPersistentForm;
    3874    Database: TSQLDatabase;
     75    TreeState: TTreeState;
    3976    procedure LoadTree;
    4077    procedure LoadItemList;
     
    4582
    4683implementation
     84
     85uses
     86  UItemView, UItemEdit;
    4787
    4888{$R *.lfm}
     
    87127  LoadConfiguration;
    88128  Database.Connect;
     129  TreeState := TTreeState.Create;
    89130  PersistentForm := TPersistentForm.Create;
    90131end;
    91132
     133procedure TMainForm.FormDestroy(Sender: TObject);
     134begin
     135  TreeState.Destroy;
     136  Database.Destroy;
     137  PersistentForm.Destroy;
     138end;
     139
    92140procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    93141begin
    94142  PersistentForm.Save(Self);
     143end;
     144
     145procedure TMainForm.ButtonAddClick(Sender: TObject);
     146begin
     147
     148end;
     149
     150procedure TMainForm.AItemViewExecute(Sender: TObject);
     151begin
     152  ItemViewForm.Show;
     153end;
     154
     155procedure TMainForm.AObjectGroupAddGroupExecute(Sender: TObject);
     156begin
     157
     158end;
     159
     160procedure TMainForm.AItemEditExecute(Sender: TObject);
     161begin
     162  ItemEditForm.Show;
     163end;
     164
     165procedure TMainForm.AItemAddExecute(Sender: TObject);
     166begin
     167
    95168end;
    96169
     
    103176procedure TMainForm.ListView1DblClick(Sender: TObject);
    104177begin
    105   ItemViewForm.Show;
     178  AItemViewExecute(Self);
    106179end;
    107180
    108181procedure TMainForm.ListView1KeyPress(Sender: TObject; var Key: char);
    109182begin
    110   if Key = #13 then ListView1DblClick(Sender);
     183  if Key = #13 then AItemViewExecute(Self);
    111184end;
    112185
     
    125198    SelectedItem := Integer(ListView1.Selected.Data)
    126199    else SelectedItem := 0;
     200
     201  AItemDelete.Enabled := Assigned(ListView1.Selected);
     202  AItemView.Enabled := Assigned(ListView1.Selected);
     203  AItemEdit.Enabled := Assigned(ListView1.Selected);
    127204end;
    128205
     
    130207begin
    131208  LoadItemList;
     209  AObjectGroupDelete.Enabled := Assigned(TreeView1.Selected);
     210  AObjectGroupEdit.Enabled := Assigned(TreeView1.Selected);
     211  if Assigned(TreeView1.Selected) then begin
     212    if TreeView1.Selected.ImageIndex = 0 then
     213      TreeView1.PopupMenu := PopupMenuObjectGroup;
     214    if TreeView1.Selected.ImageIndex = 1 then
     215      TreeView1.PopupMenu := PopupMenuObject;
     216  end;
    132217end;
    133218
     
    142227begin
    143228  with TreeView1, Items do begin
     229    TreeState.SaveTree(TreeView1);
    144230    Clear;
    145231    AddChild(nil, 'Skupiny');
    146     DbRows := Database.Query('SELECT * FROM `MenuGroup`');
     232    TopItem.ImageIndex := 0;
     233    TopItem.SelectedIndex := 0;
     234    DbRows := Database.Query('SELECT * FROM `ObjectGroup`');
    147235    for I := 0 to DbRows.Count - 1 do begin
    148236      NewNode := AddChild(TopItem, DbRows[I].Values['Name']);
    149       ObjectDbRows := Database.Query('SELECT * FROM `Object` WHERE `MenuGroup`=' + DbRows[I].Values['Id']);
     237      NewNode.ImageIndex := 0;
     238      NewNode.SelectedIndex := 0;
     239      ObjectDbRows := Database.Query('SELECT * FROM `Object` WHERE `Group`=' + DbRows[I].Values['Id']);
    150240      for O := 0 to ObjectDbRows.Count - 1 do begin
    151241        NewObjectNode := AddChild(NewNode, ObjectDbRows[O].Values['Name']);
    152         NewObjectNode.ImageIndex := StrToInt(ObjectDbRows[O].Values['Id']);
     242        NewObjectNode.Data := Pointer(StrToInt(ObjectDbRows[O].Values['Id']));
     243        NewObjectNode.ImageIndex := 1;
     244        NewObjectNode.SelectedIndex := 1;
    153245      end;
    154246      ObjectDbRows.Destroy;
     
    156248    TopItem.Expand(True);
    157249    DbRows.Destroy;
     250    TreeState.LoadTree(TreeView1);
    158251  end;
    159252end;
     
    173266  with ListView1, Items do begin
    174267    Clear;
    175     DbRows := Database.Query('SELECT * FROM `Object` WHERE `Id`=' + IntToStr(TreeView1.Selected.ImageIndex));
     268    DbRows := Database.Query('SELECT * FROM `Object` WHERE `Id`=' + IntToStr(Integer(TreeView1.Selected.Data)));
    176269    if DbRows.Count = 1 then begin
    177270      SelectedObject := StrToInt(DbRows[0].Values['Id']);
Note: See TracChangeset for help on using the changeset viewer.