Which GoCollapsibleHandle was clicked

I have a TreeAppNode with two GoCollapsibleHandles.
I want one handle to collapse/expand specific child nodes, and the other handle to collapse/expand the other child nodes.

Currently, the sub that implements IGoCollapsible.Collapse runs when either of the GoCollapsibleHandles is clicked. There’s no way to figure out which of the handles was clicked.

Any ideas?


GoCollapsibleHandle just calls Expand / Collapse on its first IGoCollapsible parent.

so… you could have second IGoCollapsible parent that you embed one of the two handles in, or you could derive a GoCollapsibleHandle that overrides OnSingleClick and calls the parent at a different set of Expand/Collapse methods.

Jake, thanks for the quick response.

I created a couple of new classes derived from GoCollapsibleHandle, overrode OnSingleClick, and wrote my own Expand/Collapse methods.

That worked great.

The issue I have now is that when I expand/collapse one handle, both images change [both become ‘plus’ or ‘minus’].

I noticed that the SetExpanded method is what causes the graphics the change. While debugging, if I only comment out the line myExpanded = e, then the graphics don’t change. Ok, one step closer to the goal. However, I can’t figure out how that statement keeps the graphics from changing? myExpanded is just a private class variable, and it is being set to the passed in parameter (e). myExpanded is not used anywhere else after that statement, yet it keeps the images from changing.

Any suggestions?

Thank you very much.

Paint uses FindCollapsible to get the parent, then uses IsExpanded to determine the state. So, if you have 2 possible expanded states, I think you need 2 parents. You could create a fake parent with a GoGroup derived class that implements IGoCollapsible.


Where would the fake GoGroup parent fit in?

Currently, I have a TreeAppNode with two custom (h1, h2) Handler classes.

While debugging, I notice that if I click the h2 handler to collapse, the code still calls Paint/PaintHandle/FindCollapsible for the h1 handler. I figure that’s where the h1 image changes from - to +. I’m thinking some code is going through all of the handlers in my Node and calling their Paint… functions.

Would I be creating 2 fake GoGroup parents, adding each handler to one parent, and then adding both GoGroup parents to my TreeAppNode?

just use it as a wrapper for one of the two handles.

Here’s the hierarchy:

+ Node

+ CollapsibleHandle1

+ GoGroup class that implements IGoCollapsible

+ CollapsibleHandle2

so, you would Add CH2 to the Group, then add the group to the node.

The Paints for the handles can be called at any point, you just have to create 2 contexts for “IsExpanded” for the two handles, and that’s what the GoGroup gives you.