Change in TabStrip DocumentWindow creation event order

Docking/MDI for Windows Forms Forum

Posted 13 years ago by Adamczak - Developer, AAA Software Enterprises
Version: 2.0.0081
Avatar
I just upgraded my appliations from UIStudio 1.0 to 2.0, and I'm having a problem getting around a behavior change, so this is a question on how to do it. First what I'm experiencing. I think the order of DocumentWindow creation has changed in an unexpected way between the two different versions of UIStudio. In UIStudio 1.0, when you created a new DocumentWindow, the events for contained controls occurred in roughly this order:

Constructor
OnSize
OnLoad
Show

This is the most common way that .Net control containers behave. In UIStudio 2.0 I'm seeing the following behavior (I could be off a bit, but this seems to be the behavior):

Constructor
OnLoad
Show
OnSize

So here's my problem. Most of the controls that are contained in DocumentWindows have their own layout state information that they save (this problem specifically affects splitters and splitter panels). In UIStudio 1.0 I would load that state in the OnLoad event, and things were just fine. When I upgraded, I started getting errors saying that the splitter location must be within the right bounds, etc. So I stepped into the code and noticed that in the OnLoad event, my view's size was still set to 0,0. So after some experimentation I noticed that the OnSize event fired after OnLoad, so I said, "ok, I can hook the first onsize event and load my state in there". That worked ok, except for one thing (the thing I'm trying to get around). If I load my splitter state in the OnSize event, when the view is brought up, it first loads with the default layout (one from the designer), then it flashes to the loaded state. So that tells me that the OnSize event occurs after the control is displayed. It first displays with the designer state, then loads the saved state. So the question is: Is there an event in UIStudio 2.0 that I can hook that fires before the control is shown, but after the sizes of the controls are set?

Thanks

Comments (4)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Check out the documentation under "Window Lifecycle". If you use the WindowInitializing event, does that work for your scenario?


Actipro Software Support

Posted 13 years ago by Adamczak - Developer, AAA Software Enterprises
Avatar
WindowInitializing fires before the window has its bounds set (the rectangle is still 0, 0, 0, 0). So this event will not work for me. It seems that the creation of the controls in the DocumentWindow is backwards from all of the other container controls that I know of.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
To verify, as long as you have any bounds size (even if it's not the target size) such as 200x200 at the time of the OnLoad event, you would be ok?


Actipro Software Support

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ok what I ended up doing was adding a DefaultSize override of 200x200 to the TabbedMdiWindow class. I tested by adding a UserControl as a child and overriding its OnLoad method. In each case when the tool window was loaded with the UserControl child, the size was now non-zero whereas it was always zero before the change.

Will that work for you? I assume your splitters will resize as the tool window is scaled to various sizes.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 9 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.