-
Yes. Also tried to create 10 windows in the cycle could close only two. Eight MDIChild windows did not closed.When all MDIChild windows MAXIMIZEd no caption.
-
program MDI_Demo;
uses
Windows, Messages, KOL;
var
MDIClient: PControl;
MainMenu: PMenu;
i: Integer;
procedure CreateMDIChild;
var MDIChild: PControl; ActiveWnd: HWnd; Maximized: BOOL;
begin
ActiveWnd := MdiClient.Perform(WM_MDIGETACTIVE, 0, Integer(@Maximized));
if Maximized then
MdiClient.Perform(WM_MDIRESTORE, ActiveWnd, 0);
MDIChild := NewMDIChild(MDIClient, 'MDI Child '+ int2str(i)).SetClientSize(320, 200);
MDIChild.Border := 10;
NewPanel(MDIChild, esRaised).SetAlign(caClient);
MDIChild.CreateWindow;
inc(i);
if Maximized then
MdiClient.Perform(WM_MDIMAXIMIZE, MDIChild.Handle, 0);
end;
procedure MenuItems(Dummy: Pointer; Sender: PMenu; Item: Integer);
begin
case Item of
1: CreateMDIChild;
3: MDIClient.Perform(WM_MDITILE, MDITILE_VERTICAL, 0);
4: MDIClient.Perform(WM_MDICASCADE, 0, 0);
end;
end;
begin
Applet := NewForm(nil, 'MDI Demo').SetPosition(240, 120).SetClientSize(380, 280);
Applet.Font.FontName := 'MS Shell Dlg';
MainMenu := NewMenu(Applet, 0, ['New', '(', 'Create MDI Child', ')', 'Window', '(', 'Tile', 'Cascade', ')', ''], TOnMenuItem(MakeMethod(nil, @MenuItems)));
MDIClient := NewMDIClient(Applet, 0).SetAlign(caClient);
CreateMDIChild;
Run(Applet);
end.
-
Still the same problem:
1- maximize mdi child window 2- menu > new > create mdi child 3- exit application = error
-
Version 3.00.S is uploaded with fixes for MDI. First, add USE_MDI symbol to defines of a project! Second, to obtain automatic windows enumeration, do the following: var m: Integer;
begin
Applet := NewForm(nil, 'MDI test').SetPosition(240, 120).SetClientSize(380, 280);
Applet.Font.FontName := 'MS Sans Serif';
MainMenu := NewMenu(Applet, 0, ['New', '(', 'Create MDI Child', ')', 'Window', '(', 'Tile', 'Cascade','MaxMDIChild', ')', ''],
TOnMenuItem(MakeMethod(nil, @MenuItems)));
m := GetSubMenu( MainMenu.Handle, 1 );
MDIClient := NewMDIClient(Applet, m).SetAlign(caClient);
CreateMDIChild;
Run(Applet);
end.
-
Thank you very very much (yet again) Vladimir. I though that I was going crazy with this one!
-
FYI, just needs a little tidying up...
dcc32.exe -b KOL.pas -dUSE_MDI
Borland Delphi Version 15.0
Copyright (c) 1983,2002 Borland Software Corporation
KOLDEF.INC(253)
KOLDEF.INC(253)
delphidef.inc(48)
delphicommctrl.inc(1569)
KOL_ansi.inc(2317)
KOL_ansi.inc(2317)
KOL_ASM.inc(14875)
KOL.pas(65635)
87261 lines, 0.59 seconds, 188142 bytes code, 4256 bytes data.
dcc32.exe -b KOL.pas
Borland Delphi Version 15.0
Copyright (c) 1983,2002 Borland Software Corporation
KOLDEF.INC(253)
KOLDEF.INC(253)
delphidef.inc(48)
delphicommctrl.inc(1569)
KOL_ansi.inc(2317)
KOL_ansi.inc(2317)
KOL.pas(34181) Error: Undeclared identifier: 'MDIClient'
KOL.pas(34181) Error: Operator not applicable to this operand type
KOL.pas(34182) Error: Undeclared identifier: 'MDIClient'
KOL.pas(34182) Error: 'END' expected but ',' found
KOL.pas(34185) Error: '.' expected but ';' found
KOL.pas(34198) Error: Undeclared identifier: 'MDIClient'
KOL.pas(34311) Error: Undeclared identifier: 'fMDIClient'
KOL_ASM.inc(14875)
KOL.pas(65635)
-
R+ is on the site.
-
S+, certainly. S++ now on site (compiling with D2 restored, it don't know about WideString).
-
Excellent, thanks. Just one more question, is it possible to remove the separator bar in the new menu?
MainMenu := NewMenu(Applet, 0, ['New', '(', 'Create MDI Child', ')', 'Window', '(', 'Tile', 'Cascade', ')', 'MDI', '(', ')', ''], TOnMenuItem(MakeMethod(nil, @MenuItems)));
MDIClient := NewMDIClient(Applet, GetSubMenu(MainMenu.Handle, 2)).SetAlign(caClient);
The menu looks like this:
MDI == Menu caption
---- == Unwanted separator
1 MDI == List of MDI's
2 MDI
-
Do not see any separator except some space. Space can be removed just setting Applet.Border := -4;
-
-
-
-
If you about menu it is handled by system. You can use tail of you menu rather then standalone. I think it is not possible to remove this separator except you pass 0 and handle menu by your code entirely.
-
OK, thank you.
-
Bug found:
Compile with USE_MDI;UNICODE_CTRLS; then new MDI child window position is shifted to right and down of last created child.
Compile with USE_MDI; only then new MDI child window is always at the top left.
|