Custom editors - WPDefEditor, MDIChild problem

  • In my application i added a copy of WPDefActions and WPDefEditor.pas, so, from my aplication i call my custom Editor doing this:

    procedure CreateEditor;
    var
    lForm : TWPToolsEditor;
    begin
    lForm := TWPToolsEditor.Create(nil);
    lForm.ShowModal;
    FreeAndNil(lForm);
    end;

    That´s ok. But my main form is a mdi parent. So i tried do change WPDefEditor.FormStyle to fsMDIChild.
    When i create WPDefEditor form, it gets on an infinite loop! Always redrawing screen as crazy. But getting back to fsNormal FormStyle, everything works.

    How can make a custom editor be showed as MdiChild ?

    • Offizieller Beitrag

    Hi,

    How can make a custom editor be showed as MdiChild ?

    try this:

    WPIsMDIApp is required to avoid the flickering. It changes the behavior of the auto sizing of the TWPToolBar.

    Julian

  • Hi Julian,

    YES! this woked, but when Editor get closed, an exception is raised. So just to make you know, to avoid that exception, custom editor must be create with NIL, like this:

    WPIsMDIApp := true; // Make the Toolbar MDI compatible
    lForm := TWPToolsEditor.Create(nil);
    lForm.FormStyle := fsMDIChild;
    lForm.OnClose := WPDefEditorFormClose;