Solved

Treeview in-place editing problem

Posted on 2004-08-18
3
738 Views
Last Modified: 2010-04-16
Delphi 6
Win XP Home


I have a Treeview and a series of Toolbuttons.

User clicks the "Add Toolbutton".  This creates a new TreeNode and sets it to Node.EditText;
The user enters random text and presses enter.  The label data is processed by the TV.OnEdited event.

So far so good.

If the user changes the node's label but does not hit ENTER, but instead clicks another node or another control, the TV.OnEdited event doesn't seem to get called.    I tried to set the OnChanging event to say

   If (Tv.IsEditing) then
     TV.Selected.EndEdit(FALSE);

but the data is still not saved.  The label itself is changed but I have to commit the changes to a record as well and that occurs in the OnEdited event.   Any ideas?

Don
0
Comment
Question by:d32coder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
Tyrsis earned 500 total points
ID: 11835150
Hi there,

I just tried duplicating your problem and just couldn't.  I used a button to add a node via:

var
    TreeNode : TTreeNode;
begin
    TreeNode := TreeView1.Items.Add(nil, '');
    TreeNode.EditText;
end;

After that, the OnEditing gets hit, I entered random characters, and clicked off the window / another tree node, and my OnEdited event was hit.  Perhaps this is a bug in Delphi 6?  Do you have all the service packs installed?  The only time I didn't get an OnEdited event was when the Caption entered was the same as what it was before editing.  Perhaps you can post a small sample that doesn't work and maybe we can spot the problem?

Tyrsis
0
 

Author Comment

by:d32coder
ID: 11838213
Thanks for your help.    I'll review my OnEdited code a little better and see if I made an error in the way I stored the changes in my record.   I'll be back to this topic soon.

Don
0
 

Author Comment

by:d32coder
ID: 11840252
Well, Placed a ShowMessage at the top of my OnEdited event and it does indeed fire.  My problem is in my data storage routine, not in the component.  Points awarded for the time you spent trying to reproduce the error.

Don
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question