Changeset 4 for trunk


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
Files:
9 added
2 deleted
6 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']);
  • trunk/chronis.lpi

    r3 r4  
    3737      </Item1>
    3838    </RequiredPackages>
    39     <Units Count="13">
     39    <Units Count="16">
    4040      <Unit0>
    4141        <Filename Value="chronis.lpr"/>
    4242        <IsPartOfProject Value="True"/>
    4343        <UnitName Value="chronis"/>
    44         <EditorIndex Value="4"/>
    45         <WindowIndex Value="0"/>
     44        <IsVisibleTab Value="True"/>
     45        <EditorIndex Value="0"/>
     46        <WindowIndex Value="1"/>
    4647        <TopLine Value="1"/>
    47         <CursorPos X="59" Y="22"/>
    48         <UsageCount Value="144"/>
     48        <CursorPos X="59" Y="23"/>
     49        <UsageCount Value="148"/>
    4950        <Loaded Value="True"/>
    5051      </Unit0>
     
    8384        <ResourceBaseClass Value="Form"/>
    8485        <UnitName Value="UMainForm"/>
    85         <EditorIndex Value="0"/>
    86         <WindowIndex Value="0"/>
    87         <TopLine Value="87"/>
    88         <CursorPos X="26" Y="95"/>
    89         <FoldState Value=" T0iFbM3i"/>
     86        <WindowIndex Value="0"/>
     87        <TopLine Value="118"/>
     88        <CursorPos X="25" Y="144"/>
    9089        <UsageCount Value="136"/>
    91         <Loaded Value="True"/>
    9290      </Unit4>
    9391      <Unit5>
     
    106104        <IsPartOfProject Value="True"/>
    107105        <UnitName Value="UPersistentForm"/>
    108         <EditorIndex Value="3"/>
     106        <EditorIndex Value="4"/>
    109107        <WindowIndex Value="0"/>
    110108        <TopLine Value="42"/>
    111109        <CursorPos X="33" Y="46"/>
    112         <SyntaxHighlighter Value="FreePascal"/>
    113         <UsageCount Value="134"/>
    114         <Loaded Value="True"/>
    115         <DefaultSyntaxHighlighter Value="Text"/>
     110        <UsageCount Value="138"/>
     111        <Loaded Value="True"/>
    116112      </Unit6>
    117113      <Unit7>
     
    119115        <IsPartOfProject Value="True"/>
    120116        <UnitName Value="USqlDatabase"/>
    121         <UsageCount Value="134"/>
    122         <DefaultSyntaxHighlighter Value="Text"/>
     117        <EditorIndex Value="2"/>
     118        <WindowIndex Value="0"/>
     119        <TopLine Value="385"/>
     120        <CursorPos X="1" Y="374"/>
     121        <UsageCount Value="138"/>
     122        <Loaded Value="True"/>
    123123      </Unit7>
    124124      <Unit8>
     
    129129        <TopLine Value="32"/>
    130130        <CursorPos X="21" Y="13"/>
    131         <SyntaxHighlighter Value="FreePascal"/>
    132         <UsageCount Value="134"/>
    133         <DefaultSyntaxHighlighter Value="Text"/>
     131        <UsageCount Value="138"/>
    134132      </Unit8>
    135133      <Unit9>
     
    139137        <ResourceBaseClass Value="Form"/>
    140138        <UnitName Value="UItemView"/>
    141         <IsVisibleTab Value="True"/>
    142         <EditorIndex Value="1"/>
    143         <WindowIndex Value="0"/>
    144         <TopLine Value="45"/>
    145         <CursorPos X="3" Y="61"/>
    146         <UsageCount Value="30"/>
     139        <EditorIndex Value="0"/>
     140        <WindowIndex Value="0"/>
     141        <TopLine Value="68"/>
     142        <CursorPos X="30" Y="100"/>
     143        <UsageCount Value="34"/>
    147144        <Loaded Value="True"/>
    148145      </Unit9>
     
    153150        <ResourceBaseClass Value="Form"/>
    154151        <UnitName Value="UItemEdit"/>
    155         <EditorIndex Value="2"/>
    156         <WindowIndex Value="0"/>
    157         <TopLine Value="2"/>
    158         <CursorPos X="33" Y="17"/>
    159         <UsageCount Value="20"/>
     152        <EditorIndex Value="1"/>
     153        <WindowIndex Value="0"/>
     154        <TopLine Value="93"/>
     155        <CursorPos X="7" Y="114"/>
     156        <UsageCount Value="25"/>
    160157        <Loaded Value="True"/>
    161158      </Unit10>
     
    165162        <HasResources Value="True"/>
    166163        <UnitName Value="ULoginForm"/>
    167         <UsageCount Value="20"/>
    168         <DefaultSyntaxHighlighter Value="Text"/>
     164        <UsageCount Value="24"/>
    169165      </Unit11>
    170166      <Unit12>
    171167        <Filename Value="Forms/UMainForm.pas"/>
    172168        <IsPartOfProject Value="True"/>
     169        <ComponentName Value="MainForm"/>
    173170        <HasResources Value="True"/>
     171        <ResourceBaseClass Value="Form"/>
    174172        <UnitName Value="UMainForm"/>
    175         <UsageCount Value="20"/>
     173        <IsVisibleTab Value="True"/>
     174        <EditorIndex Value="3"/>
     175        <WindowIndex Value="0"/>
     176        <TopLine Value="253"/>
     177        <CursorPos X="112" Y="268"/>
     178        <UsageCount Value="24"/>
     179        <Loaded Value="True"/>
     180      </Unit12>
     181      <Unit13>
     182        <Filename Value="../../../lazarus/trunk/lcl/controls.pp"/>
     183        <UnitName Value="Controls"/>
     184        <WindowIndex Value="0"/>
     185        <TopLine Value="1399"/>
     186        <CursorPos X="14" Y="1418"/>
     187        <SyntaxHighlighter Value="FreePascal"/>
     188        <UsageCount Value="10"/>
    176189        <DefaultSyntaxHighlighter Value="Text"/>
    177       </Unit12>
     190      </Unit13>
     191      <Unit14>
     192        <Filename Value="../../../lazarus/trunk/lcl/spin.pp"/>
     193        <UnitName Value="Spin"/>
     194        <WindowIndex Value="0"/>
     195        <TopLine Value="129"/>
     196        <CursorPos X="3" Y="148"/>
     197        <SyntaxHighlighter Value="FreePascal"/>
     198        <UsageCount Value="10"/>
     199        <DefaultSyntaxHighlighter Value="Text"/>
     200      </Unit14>
     201      <Unit15>
     202        <Filename Value="Common/UTreeState.pas"/>
     203        <IsPartOfProject Value="True"/>
     204        <UnitName Value="UTreeState"/>
     205        <UsageCount Value="21"/>
     206        <DefaultSyntaxHighlighter Value="Text"/>
     207      </Unit15>
    178208    </Units>
    179209    <JumpHistory Count="30" HistoryIndex="29">
    180210      <Position1>
    181         <Filename Value="Forms/UItemView.pas"/>
    182         <Caret Line="87" Column="40" TopLine="74"/>
     211        <Filename Value="Forms/UItemEdit.pas"/>
     212        <Caret Line="109" Column="33" TopLine="90"/>
    183213      </Position1>
    184214      <Position2>
    185         <Filename Value="UMainForm.pas"/>
    186         <Caret Line="146" Column="28" TopLine="92"/>
     215        <Filename Value="Forms/UItemEdit.pas"/>
     216        <Caret Line="108" Column="33" TopLine="89"/>
    187217      </Position2>
    188218      <Position3>
    189         <Filename Value="UMainForm.pas"/>
    190         <Caret Line="40" Column="23" TopLine="12"/>
     219        <Filename Value="Forms/UItemEdit.pas"/>
     220        <Caret Line="116" Column="36" TopLine="89"/>
    191221      </Position3>
    192222      <Position4>
    193         <Filename Value="UMainForm.pas"/>
    194         <Caret Line="198" Column="92" TopLine="171"/>
     223        <Filename Value="Forms/UMainForm.pas"/>
     224        <Caret Line="18" Column="39" TopLine="1"/>
    195225      </Position4>
    196226      <Position5>
    197         <Filename Value="Forms/UItemView.pas"/>
    198         <Caret Line="43" Column="1" TopLine="27"/>
     227        <Filename Value="Forms/UMainForm.pas"/>
     228        <Caret Line="189" Column="41" TopLine="182"/>
    199229      </Position5>
    200230      <Position6>
    201         <Filename Value="Common/UPersistentForm.pas"/>
    202         <Caret Line="62" Column="1" TopLine="42"/>
     231        <Filename Value="Forms/UMainForm.pas"/>
     232        <Caret Line="185" Column="29" TopLine="166"/>
    203233      </Position6>
    204234      <Position7>
    205         <Filename Value="Common/UPersistentForm.pas"/>
    206         <Caret Line="63" Column="1" TopLine="42"/>
     235        <Filename Value="Forms/UMainForm.pas"/>
     236        <Caret Line="218" Column="23" TopLine="194"/>
    207237      </Position7>
    208238      <Position8>
    209         <Filename Value="Common/UPersistentForm.pas"/>
    210         <Caret Line="64" Column="1" TopLine="42"/>
     239        <Filename Value="Forms/UMainForm.pas"/>
     240        <Caret Line="219" Column="23" TopLine="195"/>
    211241      </Position8>
    212242      <Position9>
    213         <Filename Value="Common/UPersistentForm.pas"/>
    214         <Caret Line="65" Column="1" TopLine="42"/>
     243        <Filename Value="Forms/UMainForm.pas"/>
     244        <Caret Line="220" Column="23" TopLine="196"/>
    215245      </Position9>
    216246      <Position10>
    217         <Filename Value="Forms/UItemView.pas"/>
    218         <Caret Line="76" Column="15" TopLine="76"/>
     247        <Filename Value="Forms/UMainForm.pas"/>
     248        <Caret Line="221" Column="23" TopLine="197"/>
    219249      </Position10>
    220250      <Position11>
    221         <Filename Value="Forms/UItemView.pas"/>
    222         <Caret Line="77" Column="15" TopLine="77"/>
     251        <Filename Value="Forms/UMainForm.pas"/>
     252        <Caret Line="196" Column="1" TopLine="185"/>
    223253      </Position11>
    224254      <Position12>
    225         <Filename Value="Forms/UItemView.pas"/>
    226         <Caret Line="76" Column="15" TopLine="76"/>
     255        <Filename Value="Forms/UMainForm.pas"/>
     256        <Caret Line="55" Column="15" TopLine="36"/>
    227257      </Position12>
    228258      <Position13>
    229         <Filename Value="Forms/UItemView.pas"/>
    230         <Caret Line="77" Column="15" TopLine="77"/>
     259        <Filename Value="Forms/UMainForm.pas"/>
     260        <Caret Line="233" Column="32" TopLine="213"/>
    231261      </Position13>
    232262      <Position14>
    233         <Filename Value="Forms/UItemView.pas"/>
    234         <Caret Line="78" Column="15" TopLine="78"/>
     263        <Filename Value="Forms/UMainForm.pas"/>
     264        <Caret Line="230" Column="12" TopLine="214"/>
    235265      </Position14>
    236266      <Position15>
    237         <Filename Value="Forms/UItemEdit.pas"/>
    238         <Caret Line="8" Column="26" TopLine="1"/>
     267        <Filename Value="Forms/UMainForm.pas"/>
     268        <Caret Line="231" Column="12" TopLine="215"/>
    239269      </Position15>
    240270      <Position16>
    241         <Filename Value="Forms/UItemView.pas"/>
    242         <Caret Line="65" Column="23" TopLine="54"/>
     271        <Filename Value="Forms/UMainForm.pas"/>
     272        <Caret Line="230" Column="12" TopLine="214"/>
    243273      </Position16>
    244274      <Position17>
    245         <Filename Value="Forms/UItemView.pas"/>
    246         <Caret Line="64" Column="23" TopLine="53"/>
     275        <Filename Value="Forms/UMainForm.pas"/>
     276        <Caret Line="231" Column="12" TopLine="215"/>
    247277      </Position17>
    248278      <Position18>
    249         <Filename Value="Forms/UItemEdit.pas"/>
    250         <Caret Line="8" Column="26" TopLine="1"/>
     279        <Filename Value="Forms/UMainForm.pas"/>
     280        <Caret Line="230" Column="12" TopLine="214"/>
    251281      </Position18>
    252282      <Position19>
    253         <Filename Value="Forms/UItemEdit.pas"/>
    254         <Caret Line="9" Column="11" TopLine="1"/>
     283        <Filename Value="Forms/UMainForm.pas"/>
     284        <Caret Line="229" Column="12" TopLine="213"/>
    255285      </Position19>
    256286      <Position20>
    257         <Filename Value="Forms/UItemEdit.pas"/>
    258         <Caret Line="38" Column="9" TopLine="3"/>
     287        <Filename Value="Forms/UMainForm.pas"/>
     288        <Caret Line="230" Column="12" TopLine="214"/>
    259289      </Position20>
    260290      <Position21>
    261         <Filename Value="Forms/UItemEdit.pas"/>
    262         <Caret Line="44" Column="9" TopLine="9"/>
     291        <Filename Value="Forms/UMainForm.pas"/>
     292        <Caret Line="231" Column="12" TopLine="215"/>
    263293      </Position21>
    264294      <Position22>
    265         <Filename Value="Forms/UItemEdit.pas"/>
    266         <Caret Line="52" Column="1" TopLine="15"/>
     295        <Filename Value="Forms/UMainForm.pas"/>
     296        <Caret Line="232" Column="12" TopLine="216"/>
    267297      </Position22>
    268298      <Position23>
    269         <Filename Value="Forms/UItemEdit.pas"/>
    270         <Caret Line="26" Column="29" TopLine="1"/>
     299        <Filename Value="Forms/UMainForm.pas"/>
     300        <Caret Line="231" Column="12" TopLine="215"/>
    271301      </Position23>
    272302      <Position24>
    273         <Filename Value="Forms/UItemEdit.pas"/>
    274         <Caret Line="35" Column="13" TopLine="1"/>
     303        <Filename Value="Forms/UMainForm.pas"/>
     304        <Caret Line="230" Column="12" TopLine="214"/>
    275305      </Position24>
    276306      <Position25>
    277         <Filename Value="Forms/UItemEdit.pas"/>
    278         <Caret Line="63" Column="20" TopLine="44"/>
     307        <Filename Value="Forms/UMainForm.pas"/>
     308        <Caret Line="229" Column="12" TopLine="213"/>
    279309      </Position25>
    280310      <Position26>
    281         <Filename Value="Forms/UItemView.pas"/>
    282         <Caret Line="9" Column="13" TopLine="76"/>
     311        <Filename Value="Forms/UMainForm.pas"/>
     312        <Caret Line="228" Column="12" TopLine="212"/>
    283313      </Position26>
    284314      <Position27>
    285         <Filename Value="Forms/UItemView.pas"/>
    286         <Caret Line="26" Column="1" TopLine="1"/>
     315        <Filename Value="Forms/UMainForm.pas"/>
     316        <Caret Line="229" Column="12" TopLine="213"/>
    287317      </Position27>
    288318      <Position28>
    289         <Filename Value="Forms/UItemView.pas"/>
    290         <Caret Line="35" Column="27" TopLine="1"/>
     319        <Filename Value="Forms/UMainForm.pas"/>
     320        <Caret Line="230" Column="12" TopLine="214"/>
    291321      </Position28>
    292322      <Position29>
    293         <Filename Value="Forms/UItemView.pas"/>
    294         <Caret Line="24" Column="21" TopLine="16"/>
     323        <Filename Value="Forms/UMainForm.pas"/>
     324        <Caret Line="231" Column="12" TopLine="215"/>
    295325      </Position29>
    296326      <Position30>
    297         <Filename Value="Forms/UItemView.pas"/>
    298         <Caret Line="55" Column="3" TopLine="53"/>
     327        <Filename Value="Forms/UMainForm.pas"/>
     328        <Caret Line="232" Column="12" TopLine="216"/>
    299329      </Position30>
    300330    </JumpHistory>
  • trunk/chronis.lpr

    r3 r4  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   Forms, UPersistentForm, URegistry, USqlDatabase,
     10  Forms, UPersistentForm, URegistry, USqlDatabase, UTreeState,
    1111UItemView, UItemEdit, ULoginForm, UMainForm
    1212  { you can add units after this };
     
    1616begin
    1717  Application.Initialize;
     18  Application.CreateForm(TMainForm, MainForm);
    1819  Application.CreateForm(TItemViewForm, ItemViewForm);
    1920  Application.CreateForm(TItemEditForm, ItemEditForm);
Note: See TracChangeset for help on using the changeset viewer.