Add items "Check for updates" and "About" to window menu of session manager. Fixes issue #1296

This commit is contained in:
Ansgar Becker
2009-08-18 20:33:14 +00:00
parent 4bf22d785e
commit d8944ad3eb
3 changed files with 23 additions and 0 deletions

View File

@ -52,6 +52,7 @@ begin
Application.Title := APPNAME;
Application.UpdateFormatSettings := False;
Application.CreateForm(TMainForm, MainForm);
Application.OnMessage := Mainform.OnMessageHandler;
debug('perf: Main created.');
try

View File

@ -116,6 +116,7 @@ end;
procedure Tconnform.FormCreate(Sender: TObject);
var
LastSession: String;
hSysMenu: THandle;
begin
// Fix GUI stuff
InheritFont(Font);
@ -131,6 +132,11 @@ begin
LastSession := GetRegValue(REGNAME_LASTSESSION, '');
SelectNode(ListSessions, FSessionNames.IndexOf(LastSession));
ValidateControls;
// Add own menu items to system menu
hSysMenu := GetSystemMenu(Handle, False);
AppendMenu(hSysMenu, MF_SEPARATOR, 0, #0);
AppendMenu(hSysMenu, MF_STRING, MSG_UPDATECHECK, PAnsiChar(Mainform.actUpdateCheck.Caption));
AppendMenu(hSysMenu, MF_STRING, MSG_ABOUT, PAnsiChar(Mainform.actAboutBox.Caption));
end;

View File

@ -33,6 +33,8 @@ const
// number of seen (or simulated) rows the scrollbar should project.
SIMULATE_INITIAL_ROWS = 10000;
SIMULATE_MORE_ROWS = 20;
MSG_UPDATECHECK = WM_USER + 1;
MSG_ABOUT = WM_USER + 2;
type
TMainForm = class(TForm)
@ -876,6 +878,7 @@ type
procedure SetEditorTabCaption(Editor: TFrame; ObjName: WideString);
procedure ResetSelectedTableStuff;
procedure SetWindowCaption;
procedure OnMessageHandler(var Msg: TMsg; var Handled: Boolean);
end;
@ -9439,5 +9442,18 @@ begin
end;
procedure TMainForm.OnMessageHandler(var Msg: TMsg; var Handled: Boolean);
begin
// Clicks on system window menu get handled here
if Msg.message = WM_SYSCOMMAND then begin
case Msg.wParam of
MSG_UPDATECHECK: Mainform.actUpdateCheck.Execute;
MSG_ABOUT: Mainform.actAboutBox.Execute;
end;
Handled := True;
end;
end;
end.