TreeView - Fire AfterLabelEdit Event

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.)
Who is Participating?

Improve company productivity with a Business Account.Sign Up

arif_eqbalConnect With a Mentor Commented:
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.
DarkoLordConnect With a Mentor Commented:
You could subclass a treeview to recieve all messages... if you don't want to do that we'll find a different solution...

campinasAuthor Commented:
Then I'd have to change a lot of code.. What would be the other solution?
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

campinasAuthor Commented:
Thank you !  It's clear for me... I'll probably have to add the  check for Enter too.
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!
campinasAuthor Commented:
campinasAuthor Commented:
Then maybe forcing AfterLabelEdit is not really a practical idea...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.