Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 471
  • Last Modified:

Maximize window in MDI

I have written an MDI application.  Only one type of any specific MDI child can be open at any time.  Code is as follows:

procedure TMainForm.Customer_AccessClick(Sender: TObject);
var
  Child: TCustomerF;
  N    : Integer;  
begin
  { create a new MDI child window, The CUSTOMER ACCESS Form }
  Child := nil;
  with Application.MainForm do
    for N := 0 to MDIChildCount - 1 do
      if MDIChildren[N] is TCustomerF then
        Child := MDIChildren[N] as TCustomerF;
  if Child = nil then
    Child := TCustomerF.Create(Application)
  else
    with Child do
    begin
      if WindowState = wsMinimized then WindowState := wsNormal;
      BringToFront;
    end; {_ with Child do _}
end;

My problem is that if I have FORM_A maximized, open FORM_B, then FORM_A is put into normal mode.

I can't seem to have a maximized form without other forms being maximized as well.

What am I doing wrong?

Thanks
GTAS
0
gtas
Asked:
gtas
1 Solution
 
pjdbCommented:
All the MDI child have the same status. So if one is maximized, all are maximized, if one is not maximized all are not maximized. If you want to have some information in the MDI put them in the MDI or on a normal form which can be move a rezied by the MDI form to match the actual size.

JDB
0
 
gtasAuthor Commented:
Hi,
Thanks for answer.  I have two comments. The first part of your answer says that MDI cannot support one window maximized, and one window not maximized.  Isn't there any way around this?

The second comment is that I don't quite understand what you're saying when you state "If you want to have some information in the MDI put them in the MDI or on a normal form which can be move a rezied by the MDI form to match the actual size. "

All of my windows, except the SPLASH screen and the Main form which has my main menu, are MDI Child windows.

Can you clarify what you mean?

Thanks
GTAS

0
 
d4jaj1Commented:
I assume you want more than one child maximized in cas eteh user switches to the other windows (like press Ctrl+F6), they don't see a window in restored state.  I'd suggest this, on each fom's onActivate  procedure, put in code to set the window to maximixed. now the user may see a slight flicker with this procedure, so you may have to use the LockWindowUpdate call to get rid for the flicker (it depends on whther you create teh form or just switch to it).

Switching to another window makes the other windows go into restore (normal) state, which is teh default.  You ca get arond this by using the code above.  It rally doesn't matter if Windows puts a child in restore state, just as long as teh user doens't know about it or have to do anthing to get it back to maximized.  Good Luck.  Any questions, please ad a comment.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now