Solved

Treeview in-place editing problem

Posted on 2004-08-18
3
711 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now