Solved

System menu

Posted on 2000-03-18
6
159 Views
Last Modified: 2010-04-04
How can I call system menu from the code (I have a form with no caption and need system menu to come after clicking my own button)?

Thanks
0
Comment
Question by:shtern
  • 5
6 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2631591
hi,
the only way to do this is like:

procedure TForm1.Button1Click(Sender: TObject);
begin
//add the system menu to form
form1.bordericons := form1.bordericons + [bisystemmenu];
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
//delete the system menu from form
form1.bordericons := form1.bordericons - [bisystemmenu];
end;

Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 2633102
ps
when you say no caption ,if you mean you just have no title the above will be fine however if you mean no caption bar whatsoever you will have to make your own menu on a popup with the system menu,though you will still have the real system menu accessable on the taskbar icon of your program if you right click it.
0
 

Author Comment

by:shtern
ID: 2652646
Barry,

sorry for a long delay. I mean no caption bar. Is there any way to call the system menu? When no, maybe I should really make my own popup menu, but I'm not sure about all the items: I don't know how to realize some of the actions.

Regards,

Olga.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 17

Expert Comment

by:inthe
ID: 2655496
hi,
ok yes you will have to make your own popup menu for no caption..

i will make example with the actions to perform and post here tomorrow after some sleep ;-).
0
 
LVL 17

Expert Comment

by:inthe
ID: 2655674
here is how (quite simple i found)
make your popup and add the items  and do:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, StdCtrls;

type
  TForm1 = class(TForm)
    PopupMenu1: TPopupMenu;
    Button1: TButton;
    Restore1: TMenuItem;
    Move1: TMenuItem;
    Size1: TMenuItem;
    Minimize1: TMenuItem;
    Maximize1: TMenuItem;
    Close1: TMenuItem;
    procedure Button1Click(Sender: TObject);
    procedure Close1Click(Sender: TObject);
    procedure Maximize1Click(Sender: TObject);
    procedure Minimize1Click(Sender: TObject);
    procedure Restore1Click(Sender: TObject);
    procedure Size1Click(Sender: TObject);
    procedure Move1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
popupmenu1.popup(form1.left,form1.top);
end;

procedure TForm1.Close1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_CLOSE, 0 );
end;

procedure TForm1.Maximize1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
end;

procedure TForm1.Minimize1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_MINIMIZE, 0 );
end;

procedure TForm1.Restore1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_RESTORE, 0 );
end;

procedure TForm1.Size1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_SIZE, 0 );
end;

procedure TForm1.Move1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_MOVE, 0 );
end;

end.
0
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
ID: 2658735
or i can now re-propose new answer  :o)


   {how to make system menu}

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, StdCtrls;

type
  TForm1 = class(TForm)
    PopupMenu1: TPopupMenu;
    Button1: TButton;
    Restore1: TMenuItem;
    Move1: TMenuItem;
    Size1: TMenuItem;
    Minimize1: TMenuItem;
    Maximize1: TMenuItem;
    Close1: TMenuItem;
    procedure Button1Click(Sender: TObject);
    procedure Close1Click(Sender: TObject);
    procedure Maximize1Click(Sender: TObject);
    procedure Minimize1Click(Sender: TObject);
    procedure Restore1Click(Sender: TObject);
    procedure Size1Click(Sender: TObject);
    procedure Move1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
popupmenu1.popup(form1.left,form1.top);
end;

procedure TForm1.Close1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_CLOSE, 0 );
end;

procedure TForm1.Maximize1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
end;

procedure TForm1.Minimize1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_MINIMIZE, 0 );
end;

procedure TForm1.Restore1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_RESTORE, 0 );
end;

procedure TForm1.Size1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_SIZE, 0 );
end;

procedure TForm1.Move1Click(Sender: TObject);
begin
Perform( WM_SYSCOMMAND, SC_MOVE, 0 );
end;

end.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question