Конференция "KOL" » DemoMDI kol(без мск) [Delphi, Windows]
 
  • RusSun © (23.10.10 21:39) [20]
    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.
  • Дмитрий К © (23.10.10 23:45) [21]
    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.

  • Jon © (24.10.10 00:01) [22]
    Still the same problem:

    1- maximize mdi child window
    2- menu > new > create mdi child
    3- exit application = error
  • Vladimir Kladov © (24.10.10 00:53) [23]
    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.

  • Jon © (24.10.10 01:15) [24]
    Thank you very very much (yet again) Vladimir.
    I though that I was going crazy with this one!
  • Jon © (24.10.10 01:39) [25]
    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)

  • Vladimir Kladov © (24.10.10 06:50) [26]
    R+ is on the site.
  • Vladimir Kladov © (24.10.10 07:28) [27]
    S+, certainly. S++ now on site (compiling with D2 restored, it don't know about WideString).
  • Jon © (24.10.10 13:27) [28]
    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

  • Vladimir Kladov © (24.10.10 15:59) [29]
    Do not see any separator except some space. Space can be removed just setting
    Applet.Border := -4;

  • Vladimir Kladov © (24.10.10 17:41) [30]
    S+++. Now it is possible Applet.MarginTop := -3; MDIChild.Border := 1;
    and results are looking like
    http://www.ipicture.ru/uploads/101024/At5cE75YtW.jpg
    http://www.ipicture.ru/uploads/101024/QwGtctR6VD.jpg
  • Vladimir Kladov © (24.10.10 17:49) [31]
  • Jon © (24.10.10 19:19) [32]
    I am afraid that you misunderstood me.
    Please see the menu in the screenshot:
    http://www.ipicture.ru/uploads/101024/57YR5RoE3z.gif
  • Vladimir Kladov © (24.10.10 19:45) [33]
    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.
  • Jon © (24.10.10 19:49) [34]
    OK, thank you.
  • Jon © (25.10.10 00:37) [35]
    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.
 
Конференция "KOL" » DemoMDI kol(без мск) [Delphi, Windows]
Есть новые Нет новых   [120350   +22][b:0][p:0.005]