Solved

TreeView - Fire AfterLabelEdit Event

Posted on 2004-08-11
7
492 Views
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.)
0
Comment
Question by:campinas
  • 4
  • 2
7 Comments
 
LVL 22

Assisted Solution

by:DarkoLord
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...

Darko
0
 

Author Comment

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

Accepted Solution

by:
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.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

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

Expert Comment

by:DarkoLord
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!
Darko
0
 

Author Comment

by:campinas
ID: 11775963
Oops...
0
 

Author Comment

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

Featured Post

What Security Threats Are You Missing?

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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

18 Experts available now in Live!

Get 1:1 Help Now