Solved

System menu

Posted on 2000-03-18
6
155 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 17

Expert Comment

by:inthe
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now