TreeView - Fire AfterLabelEdit Event

Posted on 2004-08-11
Last Modified: 2008-01-09
With VB6 and the TreeView control,

Is it possible to fire the AfterLabelEdit event even when the node label was not changed?

(While editing a label, if the user presses Enter without making any change to the label, or if simply clicks elsewhere, AfterLabelEdit is not fired.)
Question by:campinas
  • 4
  • 2
LVL 22

Assisted Solution

DarkoLord earned 100 total points
ID: 11771729
You could subclass a treeview to recieve all messages... if you don't want to do that we'll find a different solution...


Author Comment

ID: 11771843
Then I'd have to change a lot of code.. What would be the other solution?
LVL 19

Accepted Solution

arif_eqbal earned 400 total points
ID: 11772107
Well If a user starts Editing of a Label and without changing the original text comes out of editing mode then the AfterLabelEdit event is not fired. If this is your problem then you can use a bit of trick.

Declare a form level variable say EditStart
on BeforeLabelEdit event set it to True, i.e once the user starts editing we set this flag. Now in order to cancel this edit he will have to click somewhere, Now trap the LostFocus and Click event of TreeView and check if your Flag is True or not If it is then call your AfterlabelEdit event function.

In case you need a working code I can write it for you just post back here.
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 11775834
Thank you !  It's clear for me... I'll probably have to add the  check for Enter too.
LVL 22

Expert Comment

ID: 11775885
Hi again,
I tried that what arif_eqbal said even before posting my first message but I couldn't get keyboard event to fire, because when you press the key while editing, the key is actually not pressed in a treeview but in a textbox that you type into...

good luck!

Author Comment

ID: 11775963

Author Comment

ID: 11776015
Then maybe forcing AfterLabelEdit is not really a practical idea...

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

821 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