CTRL-F4 loses highlighting in ActiveX TreeView

KeithWilliams

Registered User.
Local time
Today, 20:23
Joined
Feb 9, 2004
Messages
137
Hi,

I have a form with one control, an ActiveX TreeView (MIcrosoft Treeview Control, Version 6.0). I trap the CTRL-F4 event to prevent the user closing the form. However, this leads to a problem. Whatever node is selected in the treeview, the highlighting is lost. I've established the Selected boolean value is still True for the node, and if I click in the blank space at the bottom of the treeview, it becomes highlighted again. I just want the user to be able to see that it is selected!

I've tried code like the following, among other things:

Code:
Private Sub Form_Unload(Cancel As Integer)
    Dim objNode As Object
    
    If boolCtrlF4 Then
        'Trap the attempt to close the form.
        boolCtrlF4 = False
        Cancel = True
        'Try to restore highlighting to the selected node.
        Set objNode = axTreeViewServiceHierarchy.SelectedItem
        objNode.Selected = False
        objNode.Selected = True
    End If
End Sub

However, all to no avail.

Has anyone come across anything similar with the treeview? Any suggestions?

Thanks,
Keith.
 

Users who are viewing this thread

Back
Top Bottom