Ereignis ItemStateImageChanging feuert nicht / Event ItemStateImageChanging doesn't fire

The place for threads about version 2.x of TimoSoft ExplorerTreeView.
Post Reply
johamb
Cadet
Posts: 2
Joined: 28 Dec 2016, 14:47

Ereignis ItemStateImageChanging feuert nicht / Event ItemStateImageChanging doesn't fire

Post by johamb »

Hallo!

Ich verwende das ExplorerTreeView 2.6.2 Unicode Steuerelement und suche schon seit Stunden nach einer Lösung für einen seltsamen Effekt.
Denn das Ereignis ItemStateImageChanging bzw. ~Changed wird nicht aufgerufen, obwohl alle Events aktiv (=nicht deaktiviert sind) und auch
ShowStateImages = True ist. Alle anderen Ereignisse (z.B. Click, DblClick, CaretChanged) funktionieren.

Ich vermute nur einen kleinen Fehler dahinter, denn wenn ich ein neues Projekt mit dem ETV aufsetze, dann feuert auch das ItemStateImageChanging Ereginis. (hab auch die Einstellungen beider Steuerelemente verglichen und auch die Referenzierung (GUID) in der jeweiligen Projektdatei überprüft, alles ist identisch)

Bin echt ratlos und würde mich über Hilfe sehr freuen!
Danke!
liebe Grüße
hans

Code: Select all


Private Sub expTV_ItemStateImageChanging(ByVal treeItem As ExTVwLibUCtl.ITreeViewItem, ByVal previousStateImageIndex As Long, newStateImageIndex As Long, ByVal causedBy As ExTVwLibUCtl.StateImageChangeCausedByConstants, cancelChange As Boolean)
 ' die jeweils nachfolgenden selektieren bzw. deselektieren
    Debug.Print "newStateIndex:  " & newStateImageIndex

    Screen.MousePointer = vbArrowHourglass
    DoEvents
    expTV.DontRedraw = True
    SetSubItemState treeItem, newStateImageIndex
    expTV.DontRedraw = False
    DoEvents
    Screen.MousePointer = vbDefault
End Sub

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hello!

I'm using the ExplorerTreeView 2.6.2 Unicode-Control and I'm suffering on a strange effect with it.
The both events ItemStateImageChanging and ~Changed aren't fired altough that all events are activated (= not disabled)
and the property ShowStateImages is set to TRUE. Every other event (i.e. Click, DblClick, CaretChanged) works flawlessly.

When I set up a new project with the ETV the events will be fired. (I checked all properties and the GUID from the controls in every project file
- but both are identical) I'm clueless now and I'm glad if someone could help me ...

Thanks a lot!
best regards
John

Code: Select all


Private Sub expTV_ItemStateImageChanging(ByVal treeItem As ExTVwLibUCtl.ITreeViewItem, ByVal previousStateImageIndex As Long, newStateImageIndex As Long, ByVal causedBy As ExTVwLibUCtl.StateImageChangeCausedByConstants, cancelChange As Boolean)
 ' die jeweils nachfolgenden selektieren bzw. deselektieren
    Debug.Print "newStateIndex:  " & newStateImageIndex

    Screen.MousePointer = vbArrowHourglass
    DoEvents
    expTV.DontRedraw = True
    SetSubItemState treeItem, newStateImageIndex
    expTV.DontRedraw = False
    DoEvents
    Screen.MousePointer = vbDefault
End Sub

johamb
Cadet
Posts: 2
Joined: 28 Dec 2016, 14:47

Re: Ereignis ItemStateImageChanging feuert nicht / Event ItemStateImageChanging doesn't fire

Post by johamb »

Hallo!

Ich habe mittlerweile das Problem gelöst, in dem ich das Kontrollkästchen mit Bildern simuliere.
(analog dem Beispiel OptionTreeView, das mit dem Steuerelement mitgeliefert wird)

Danke!
liebe Grüße
hans

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hello!

I solved the problem by simulating a checkbox by pictures.
(as shown in the OptionTreeView-Example)

Thanks!
best regards
John
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: Ereignis ItemStateImageChanging feuert nicht / Event ItemStateImageChanging doesn't fire

Post by TiKu »

Hi,

Sorry, ich war ein paar Tage verreist. Ich werde mir das Problem trotz vorhandener Lösung dieser Tage anschauen. Spontan fällt mir kein Grund ein, warum die Events nicht gefeuert werden sollten.

Grüße
TiKu
------------
Hi,

Sorry, I've been away for a couple of days. I'll have a look at this problem, although you've already found a workaround. For now I don't know a possible reason why those events are not fired.

Regards
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: Ereignis ItemStateImageChanging feuert nicht / Event ItemStateImageChanging doesn't fire

Post by TiKu »

I've analyzed the code. There are a couple of things that could prevent firing the events:
  • The ItemStateImageChanged event is raised only if the old and new state image are different.
  • Subclassing the control could prevent firing the events, if it is done wrong.
  • On Windows XP/2003 or if the application does not use Windows Themes, the control uses a workaround to detect state image changes. This workaround uses a timer and some fuzzy logic. I did not yet test it, but I can imagine that there are problems with this code.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: Ereignis ItemStateImageChanging feuert nicht / Event ItemStateImageChanging doesn't fire

Post by TiKu »

TiKu wrote:
  • On Windows XP/2003 or if the application does not use Windows Themes, the control uses a workaround to detect state image changes. This workaround uses a timer and some fuzzy logic. I did not yet test it, but I can imagine that there are problems with this code.
I did a test and this code seems to work correctly.
I would need a sample project that demonstrates the problem as I cannot reproduce it.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Post Reply