How would I go about implementing the Ctrl+F6 Next Window action in the Windows menu for an MDI application in Delphi 7?
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.
Send the main form a wm_SysCommand
message. Use sc_NextWindow
or sc_PrevWindow
for the wParam parameter.
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;