Solved

System menu

Posted on 2000-03-18
6
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 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