Recent

Author Topic: TEdit. Append it.  (Read 7010 times)

captian jaster

  • Guest
TEdit. Append it.
« on: May 09, 2010, 08:19:35 pm »
Im using a TEdit to work with my program. im trying to open a XML and write something to the TEdit. But theres no Append.
Code: [Select]
Form1.ForEdit.Text := Child.Attributes.Item[0].NodeValue;
This raises an error and all i want to work on now is editing the TEdit.

Wodzu

  • Full Member
  • ***
  • Posts: 171
Re: TEdit. Append it.
« Reply #1 on: May 10, 2010, 06:57:32 am »
What kind of error is raised?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: TEdit. Append it.
« Reply #2 on: May 10, 2010, 07:27:49 am »
Code: [Select]
Form1.ForEdit.Text := Child.Attributes.Item[0].NodeValue;

captian jaster, are you sure you have following objects existing?
Child
Child.Attributes
Child.Attributes.Item[0]

if any of these objects is nil you'll get the access violation

captian jaster

  • Guest
Re: TEdit. Append it.
« Reply #3 on: May 10, 2010, 04:00:14 pm »
thatts the only way i know how to write it. any other way it raises an error on compile.

eny

  • Hero Member
  • *****
  • Posts: 1659
Re: TEdit. Append it.
« Reply #4 on: May 10, 2010, 04:10:34 pm »
What skalogryz is trying to say is that you have to test if the node ('Child') has attributes at all.
If not then it will raise an error as soon as you hit a node without one.
All posts based on: Win11; Lazarus 4_4  (x64) 12-02-2026 (unless specified otherwise...)

captian jaster

  • Guest
Re: TEdit. Append it.
« Reply #5 on: May 10, 2010, 04:28:49 pm »
ok im going to rewrite that part and see what i can do..
i tryed writting it this way:
Code: [Select]
procedure TForm1.OpenBtnClick(Sender: TObject);
var
 Doc:TXMLDocument;
 ForNode,NoteNode,TopicNode:TDOMNode;
begin
  IF(OpenD.Execute)Then
  begin
    Form1.NoteBox.Clear;
    Form1.TopicEdit.Clear;
    Form1.ForEdit.Clear;
    ReadXMLFile(Doc,SaveD.FileName);
    TopicNode := Doc.DocumentElement.FindNode('Topic');
    Form1.TopicEdit := TopicNode.FirstChild.NodeValue;
    ForNode := Doc.DocumentElement.FindNode('For');
    Form1.ForEdit := ForNode.FirstChild.NodeValue;
    NoteNode := Doc.DocumentElement.FindNode('NOTE');
    Form1.NoteBox.Append(NoteNode.FirstChild.NodeValue);
  end;
end;  

it says got widestring expected TEdit. in compile
Just fixed the problem now testing
« Last Edit: May 10, 2010, 04:32:03 pm by captian jaster »

 

TinyPortal © 2005-2018