Mike Howard
Mike Howard

Reputation: 13

Delphi MDI Application Next Window menu item

How would I go about implementing the Ctrl+F6 Next Window action in the Windows menu for an MDI application in Delphi 7?

Upvotes: 1

Views: 1867

Answers (3)

Ken White
Ken White

Reputation: 125689

Use the Next and Previous methods of the MDI parent window. You can do this from a menu event, and assign a shortcut like any other menu item. In the code below, the MDI parent form is TFormMDIParent, and it assumes you've created two menu items captioned "Next Child" and "Previous Child", leaving their names set to the default generated by the IDE. It also assumes that you've set the main form up correctly to be the MDI parent (FormStyle = fsMDIForm).

procedure TFormMDIParent.NextChild1Click(Sender: TObject);
begin
  Self.Next;
end;

procedure TFormMDIParent.PreviousChild1Click(Sender: TObject);
begin
  Self.Previous;
end;

Upvotes: 2

Rob Kennedy
Rob Kennedy

Reputation: 163277

Send the main form a wm_SysCommand message. Use sc_NextWindow or sc_PrevWindow for the wParam parameter.

Upvotes: 1

Gerry Coll
Gerry Coll

Reputation: 5975

I don't think you need to do anything - it is implicit in MDI apps (created with the new MDI app wizard in Delphi 2006 anyway).

It also "just works" in an app the was originally created in Delphi 6 as well.

Upvotes: 1

Related Questions