Solved

Treeview in-place editing problem

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

Industry Leaders: 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month3 days, 13 hours left to enroll

630 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