Ignore:
Timestamp:
Aug 6, 2019, 1:55:55 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Use fcl registry.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Registry/Demo/UFormMain.pas

    r392 r538  
    1717    AConnectionDelete: TAction;
    1818    AConnectionModify: TAction;
     19    AValueAdd: TAction;
     20    AValueEdit: TAction;
     21    AValueDelete: TAction;
    1922    AImport: TAction;
    2023    AExport: TAction;
     
    2528    MenuItem2: TMenuItem;
    2629    MenuItem3: TMenuItem;
     30    MenuItem4: TMenuItem;
     31    MenuItem5: TMenuItem;
     32    MenuItem6: TMenuItem;
     33    PopupMenu1: TPopupMenu;
    2734    Splitter1: TSplitter;
    2835    StatusBar1: TStatusBar;
    2936    TreeView1: TTreeView;
     37    procedure AValueAddExecute(Sender: TObject);
    3038    procedure FormShow(Sender: TObject);
    3139    procedure ListView1Data(Sender: TObject; Item: TListItem);
     
    3341    function RegValueToString(Name: string): string;
    3442    procedure LoadNode(Node: TTreeNode; Key: TRegKey);
     43    procedure ReloadTreeNode(Node: TTreeNode; Reg: TGeneralRegistry);
    3544  public
    3645    procedure ReloadValues;
     
    7584  ReloadKeys;
    7685  ReloadValues;
     86end;
     87
     88procedure TFormMain.AValueAddExecute(Sender: TObject);
     89begin
     90//  Core.ActiveRegistry.Write;
    7791end;
    7892
     
    120134end;
    121135
     136procedure TFormMain.ReloadTreeNode(Node: TTreeNode; Reg: TGeneralRegistry);
     137var
     138  Keys: TStrings;
     139  I: Integer;
     140  NewNode: TTreeNode;
     141begin
     142  Keys := TStringList.Create;
     143  Reg.GetKeyNames(Keys);
     144  for I := 0 to Keys.Count - 1 do begin
     145    NewNode := Node.TreeNodes.AddChild(Node, Keys[I]);
     146    Reg.OpenKey(Keys[I], False);
     147    ReloadTreeNode(NewNode, Reg);
     148  end;
     149  Keys.Free;
     150end;
     151
    122152procedure TFormMain.ReloadKeys;
    123153var
    124154  NewNode: TTreeNode;
    125155begin
     156  TreeView1.Items.Clear;
    126157  NewNode := TreeView1.Items.AddChild(nil, 'Local computer');
     158  ReloadTreeNode(NewNode, Core.ActiveRegistry);
     159  NewNode.Expand(True);
    127160end;
    128161
Note: See TracChangeset for help on using the changeset viewer.