Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Treeview Help

Status
Not open for further replies.

mrdev

Programmer
Mar 25, 2001
22
0
0
NL
Hello,

I'm very very new with Delphi and I need to make a program with it for School in a few days time. I can need your help!

My problem is, I've got the following file of Delphi (I'm using Delphi 3.0):

unit xmlproject;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, Tabnotbk, XDOM_2_3;

type
TForm1 = class(TForm)
TabbedNotebook1: TTabbedNotebook;
TreeView1: TTreeView;
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
DomImplementation1: TDomImplementation;
Button2: TButton;
Memo1: TMemo;
Label2: TLabel;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);

var
MyTreeNode1: TTreeNode;
A: String;
begin
with TreeView1.Items do
begin
A:=Edit1.Text;
MyTreeNode1 := TreeView1.Items[0];
AddChild(MyTreeNode1,A);
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
Var
DD : TDOMDocument;

Procedure QuickElementCreate(Element,Value : String);
Var TE : TDOMElement;
Begin
TE := DD.CreateElement(Element);
TE.AppendChild(DD.CreateTextNode(Value));
DD.DocumentElement.AppendChild(TE);
End;

begin
With DomImplementation1 do Begin
DD := CreateDocument('pagina',nil);
QuickElementCreate('hallo','');
QuickElementCreate('url',' QuickElementCreate('email','info@site.com');
Memo1.Lines.Text := DD.CodeAsString;
FreeDocument(DD);
End;
end;

end.

Okee? You've got that? Well I'll describe how my programm is currently looking at and what I want it to look at, so that you will better understand what my goals are.

I've two tabs in my programm. One tab contains a TreeView a button and a line to put text in. If you write a line and push the button, a new item will appaer in the treeview. In the second tab there is a button(second) and a memo and a TDomInplementation (that is a component bij OpenXML: If you push the second button in the second tab, then will a XML-file appaer in my memo. That file is described in de source I showed you.

Now I don't want the XML-content of my source (the default you can say). But I want that de nodes of my TreeView become the nodes of my XML-file in the memo.

How do I do that? I think I'll have to do something like TreeView.Items[0], but I don't know how and what.

Please help!!

Greetz,

Sander Kuilman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top