Solved

Treeview in-place editing problem

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

12 Experts available now in Live!

Get 1:1 Help Now