Disappearing BorderIcons on closing an MDI child

113 Views Asked by At

I'm in the process of "upgrading" a Delphi 2007 MDI application to Delphi 11.

I noticed the following behavior when closing an MDI child. When clicking the close icon, the icon menu disappears. Not a big thing, unless you have an OnClose event handler that prevents the Form from closing. Then the border icons do not come back. Even after I added the line:

BorderIcons := [biSystemMenu,biMinimize,biMaximize];

procedure TFrmSingleParts.FormClose(Sender: TObject; var Action: TCloseAction);
var
  wMsg: Word;
begin
  if (BcStockPart1.State = bcsInsert) then
  begin
    wMsg := gblPmsMessage.Show('ADDSTOCK', dmtConfirmation, [dmbYes, dmbNo, dmbCancel], 0);
    case wMsg of
    mrYes:
    begin
      BcStockPart1.Post;
      Action := caFree
    end;
    mrNo:
    begin
      BcStockPart1.Cancel;
      Action := caFree
    end;
    mrCancel:
    begin
      Action := caNone;
      BorderIcons := [biSystemMenu,biMinimize,biMaximize];
    end;
    end;
  end
  else
  begin
    Action := caFree;
  end;
end;

Any suggestions on how to restore the BorderIcons if the Form is not actually closed?

0

There are 0 best solutions below