Disclosure Triangle always starts with window open.

I have a disclosure triangle on a window, initial state value is off, there is an open and a close event setup, which simply are supposed to

winPrefs.show and winPrefs.hide . (Window called winPrefs).

When running, it always defaults to open. I want it so that it defaults to closed until the disclosure triangle is clicked.

What am I doing wrong?

Let’s start with ‘what are you doing’? :slight_smile:

Do you set the state to closed in the Window Open() event?
DO you invalidate the control afterwards?

In the control.open event windowPrefs.hide or windowPrefs.visible=false ?

DisclosureTriangle.open
winPrefs.show

DisclosureTriangle.close
winPrefs.hide

Jeff:

I do not set the state to closed in the window open event.

I do not invalidate the control afterwards.

Ok, Just for someone else stumbling along at the beginning, here is how I fixed it:

If Me.value Then
//User has opened it.
Dim w As New winPrefs
w.show
w.top = Self.top + Me.top
w.Left = Self.Left + Self.width

Else
//User has closed it.
For i As Integer = 0 To WindowCount-1
If Window(i) IsA winPrefs Then
Window(i).close
End
Next
End

[quote=471811:@Bill Marcy]DisclosureTriangle.open
winPrefs.show

DisclosureTriangle.close
winPrefs.hide[/quote]
These events are not what you’re assuming they are. For more information, check out the documentation on both events:
Close event
Open event

With just a little more exploration, you’ll find you want the Action event to handle the window state.