|
MDI - Behaviour of Maximized MDI Child Windows Overview: Once upon a time, I did some research about how to get a nice and contained look of a Windows application, not disturbing and discouringing to the not-so-computer-literate users. SDI - stacking windows of different sizes over each other - no, that didn’t look very nice. Generic MDI offers a container (the MDI parent) but its contents is hard to comprehend for the average user. There are windows of different sizes and in different status (maximized, iconized, resized) in the parent’s space, maybe some windows are not fully shown. I decided for a user interface where there is a single visible window (an MDI child) always maximized in the MDI parent’s space. Possibly there are several child windows stacked over each other but closing the topmost window will reveal the next underlying one. - It’s rather easy to make an MDI child maximize on opening, there’s a choice for that in the GUI Tab of the windows description. - First problem is that resizing the parent will not automatically maximize the curently shown MDI child window in the parent’s space. Easy cure: put a Maximize(“”) into the ‘On Resizing ..’ Event of the MDI child Window. - Second problem appears when stacking two MDI child windows over each other and after that we do a resize of the MDI parent. Closing the topmost window will reveal that the underlying window has not been resized as it happened to the topmost child window. The cure: put a few lines of code into the ‘Got Focus ..’ Event of the MDI child window. Interestingly, a simple Maximize(“”) will not do the job - because the window ‘thinks’ is had been already maximized, therefore it refuses to maximize a second time! The secret: first do an iconize and then a maximize! Warning: Slow computers will show a flicker during the process. If this is a problem, you just have to resize the window to the correct size. That’s a bit more of a challenge: IF FOCUS = False THEN WinSize("",WinInWidth(Menu)-Menu..MDILeft+5,WinInHeight(Menu)+5) FOCUS = TrueENDWarning: the 5 pixels depend on the theme used! It may be some pixels less or more!This method is just fine for slow computers, the window is resized without showing any blink. The ‘brute force method’ for faster computers: IF MyFocus = False THEN Iconize(""); Maximize("") MyFocus = TrueEND
Download the project:WD15_MDI_Behaviour.zip
|