We help IT Professionals succeed at work.

Saving changes when i change the text on the display - VirtualStringTree

Alpha_AI
Alpha_AI asked
on
236 Views
Last Modified: 2010-04-05
Hello, I can modify the text on the display but there seems to be a problem with the saving of the text.
Im not too sure where to put this

       Form1.MyVirtualStringTree1.SaveToFile(ExtractFilePath(Application.ExeName)+'\knowledgebank.dat');

//////////

Heres the code below for the NewText area.
 

procedure TForm1.MyVirtualStringTree1NewText(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Column: TColumnIndex; NewText: WideString);
var
  Data: PNodeData;
begin
   Data:=Sender.GetNodeData(Node);
   if Assigned(Data) then
   begin
      case Column of
       0: Data^.DictionaryWord := NewText;
       1: Data^.Type1 := NewText;
       2: Data^.Meaning1 := NewText;
       3: Data^.Meaning2 := NewText;
       4: Data^.Meaning3 := NewText;
       5: Data^.Meaning4 := NewText;
       6: Data^.Meaning5 := NewText;
       7: Data^.Meaning6 := NewText;

      end;

   end;


end;

So yeah when i close the program and reopen it the saved changes are not there.
Thanks,

Ben
Comment
Watch Question

Commented:
try to invoke
Form1.MyVirtualStringTree1.LoadFromFile(ExtractFilePath(Application.ExeName)+'\knowledgebank.dat');
at the program startup

Author

Commented:
What does invoke mean?

On FormCreate i have this:

if fileexist(blah blah) then
begin
Form1.MyVirtualStringTree1.LoadFromFile(ExtractFilePath(Application.ExeName)+'\knowledgebank.dat');
end;

Commented:
than it should work fine
check the file contents after the program is closed
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks that did solve the problem.

Excellent.

Ben
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.