⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fm_newname.~pas

📁 realworld source code
💻 ~PAS
字号:
unit FM_NewName;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, xmldom, XMLIntf, msxmldom, XMLDoc, ComCtrls, RzTreeVw;

type
  TFMNewName = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FMNewName: TFMNewName;

implementation
uses
 FM_RSS;
{$R *.dfm}

procedure TFMNewName.Button1Click(Sender: TObject);

var
  ItemsParent:TTreeNode;
  XMLNode:IXMLNode;
  j,I:integer;
  SList:TStringList;
  XMLDocu1:TXMLDocument;
begin
 j:=0;
 I:=0;
 SList:=TStringList.Create;
 SList.Clear;
 ItemsParent:=FMRSS.RzTreeView2.Selected.Parent;
    j:=FMRSS.RzTreeView2.Selected.Index;
    while ItemsParent<>nil do
     begin
      SList.Add(inttostr(ItemsParent.index));
      ItemsParent:=ItemsParent.Parent;
     end;
    SList.Delete(SList.Count-1);
    XMLDocu1:=TXMLDocument.Create(self);
    XMLDocu1.FileName:=ExtractFilePath(Application.ExeName)+'Favorite.xml';
    XMLDocu1.Active:=True;
    XMLNode:=XMLDocu1.Node.ChildNodes.Nodes[0];
    if SList.Text<>'' then
     begin
      while SList.Text <>'' do
       begin
        XMLNode:=XMLNode.ChildNodes.Nodes[strtoint(SList.Strings[SList.Count-1])];
        SList.Delete(SList.Count-1);
       end;
      XMLNode.ChildNodes.Nodes[j].Attributes['Name']:=Edit1.Text;
     end
    else
      XMLNode.ChildNodes.Nodes[j].Attributes['Name']:=Edit1.Text;
   XMLDocu1.SaveToFile(ExtractFilePath(Application.ExeName)+'Favorite.xml');
   FMRSS.RzTreeView2.Selected.Text:=Edit1.Text;
   XMLDocu1.Free;
end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -