mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 16:38:17 +02:00
MG: fixed examples
git-svn-id: trunk@3583 -
This commit is contained in:
parent
e5283fc1bb
commit
acfed31bc8
@ -162,7 +162,7 @@ end;
|
||||
|
||||
procedure TForm1.FormDestroy(Sender : TObject);
|
||||
begin
|
||||
// Application.Terminate;
|
||||
|
||||
end;
|
||||
|
||||
procedure TForm1.button1MouseDown(Sender: TObject; Button: TMouseButton;
|
||||
|
@ -162,8 +162,7 @@ end;
|
||||
|
||||
procedure TForm1.FormKill(Sender : TObject);
|
||||
Begin
|
||||
// Free;
|
||||
Application.terminate;
|
||||
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -414,6 +413,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2002/10/30 13:44:29 lazarus
|
||||
MG: fixed examples
|
||||
|
||||
Revision 1.5 2002/10/29 08:22:32 lazarus
|
||||
MG: added interfaces unit
|
||||
|
||||
|
@ -166,7 +166,7 @@ end;
|
||||
|
||||
procedure TForm1.FormKill(Sender : TObject);
|
||||
Begin
|
||||
// Application.terminate;
|
||||
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -377,7 +377,7 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TForm1.mnuQuitClicked(Sender : TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
Close;
|
||||
end;
|
||||
{------------------------------------------------------------------------------}
|
||||
|
||||
@ -389,6 +389,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.8 2002/10/30 13:44:29 lazarus
|
||||
MG: fixed examples
|
||||
|
||||
Revision 1.7 2002/10/29 08:22:32 lazarus
|
||||
MG: added interfaces unit
|
||||
|
||||
|
@ -114,14 +114,14 @@ end;
|
||||
|
||||
procedure TSampleDialogs.FormDestroy(Sender : TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
|
||||
end;
|
||||
|
||||
procedure TSampleDialogs.buttonClick(Sender : TObject);
|
||||
begin
|
||||
|
||||
case TButton(Sender).Tag of
|
||||
1 : Application.Terminate;
|
||||
1 : Close;
|
||||
2 : with TOpenDialog.Create(Self) do
|
||||
begin
|
||||
Filter := '*.pp';
|
||||
|
@ -1,9 +1,6 @@
|
||||
{ $Id$ }
|
||||
{
|
||||
/***************************************************************************
|
||||
main.pp - Toolbar
|
||||
-------------------
|
||||
TMain is the application toolbar window.
|
||||
|
||||
|
||||
Initial Revision : Sun Mar 28 23:15:32 CST 1999
|
||||
@ -39,33 +36,31 @@ uses
|
||||
SysUtils;
|
||||
|
||||
type
|
||||
TForm1 = class(TFORM)
|
||||
public
|
||||
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Button3: TButton;
|
||||
Button4: TButton;
|
||||
TForm1 = class(TFORM)
|
||||
public
|
||||
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Button3: TButton;
|
||||
Button4: TButton;
|
||||
grpTst : TGroupBox;
|
||||
mnuBarMain: TMenuBar;
|
||||
mnuFile: TMenu;
|
||||
mnuFile: TMainMenu;
|
||||
itmFileQuit: TMenuItem;
|
||||
CheckBox1 : TCheckBox;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure LoadMainMenu;
|
||||
Procedure FormKill(Sender : TObject);
|
||||
procedure mnuQuitClicked(Sender : TObject);
|
||||
protected
|
||||
procedure Button1CLick(Sender : TObject);
|
||||
procedure Button2CLick(Sender : TObject);
|
||||
procedure Button3CLick(Sender : TObject);
|
||||
procedure Button4CLick(Sender : TObject);
|
||||
end;
|
||||
procedure mnuQuitClicked(Sender : TObject);
|
||||
protected
|
||||
procedure Button1CLick(Sender : TObject);
|
||||
procedure Button2CLick(Sender : TObject);
|
||||
procedure Button3CLick(Sender : TObject);
|
||||
procedure Button4CLick(Sender : TObject);
|
||||
end;
|
||||
|
||||
var
|
||||
Form1 : TForm1;
|
||||
|
||||
constructor TForm1.Create(AOwner: TComponent);
|
||||
constructor TForm1.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
Caption := 'Groubox Demo v0.1';
|
||||
@ -80,8 +75,8 @@ End;
|
||||
procedure TForm1.Button2Click(Sender : TObject);
|
||||
Begin
|
||||
if assigned (grpTst) then begin
|
||||
grpTst.Width := grpTst.Width + 10;
|
||||
grpTst.Show;
|
||||
grpTst.Width := grpTst.Width + 10;
|
||||
grpTst.Show;
|
||||
end;
|
||||
End;
|
||||
|
||||
@ -95,23 +90,16 @@ End;
|
||||
procedure TForm1.Button4Click(Sender : TObject);
|
||||
Begin
|
||||
if assigned (grpTst) then begin
|
||||
grpTst.Hide;
|
||||
grpTst.Hide;
|
||||
end;
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
|
||||
procedure TForm1.FormKill(Sender : TObject);
|
||||
Begin
|
||||
Application.terminate;
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TForm1.LoadMainMenu;
|
||||
|
||||
begin
|
||||
OnDestroy := @FormKill;
|
||||
|
||||
{ set the height and width }
|
||||
Height := 350;
|
||||
Width := 700;
|
||||
@ -122,12 +110,12 @@ grpTst.Parent := self;
|
||||
grpTst.top := 70;
|
||||
grpTst.left := 10;
|
||||
grpTst.Height :=200;
|
||||
grpTst.Width := 300;
|
||||
grpTst.Width := 300;
|
||||
grpTst.Show;
|
||||
grpTst.Caption := 'Groupbox with 2 Buttons';
|
||||
|
||||
{ Create 2 buttons inside the groupbox }
|
||||
if assigned (grpTst) then
|
||||
if assigned (grpTst) then
|
||||
begin
|
||||
Button2 := TButton.Create(grpTst);
|
||||
Button2.Parent := grpTst;
|
||||
@ -145,7 +133,7 @@ Button2.Caption := 'Width ++';
|
||||
Button2.OnClick := @Button2Click;
|
||||
|
||||
|
||||
if assigned (grpTst) then
|
||||
if assigned (grpTst) then
|
||||
begin
|
||||
Button1 := TButton.Create(grpTst);
|
||||
Button1.Parent := grpTst;
|
||||
@ -183,31 +171,19 @@ Button4.Show;
|
||||
Button4.Caption := 'Hide';
|
||||
Button4.OnClick := @Button4Click;
|
||||
|
||||
mnuFile := TMenu.Create(nil);
|
||||
mnuFile := TMainMenu.Create(Self);
|
||||
|
||||
itmFileQuit := TMenuItem.Create(nil);
|
||||
itmFileQuit := TMenuItem.Create(Self);
|
||||
itmFileQuit.Caption := 'Quit';
|
||||
itmFileQuit.OnClick := @mnuQuitClicked;
|
||||
// itmFileQuit.Show;
|
||||
mnuFile.Items.Add(itmFileQuit);
|
||||
|
||||
mnuFile.Items.Add (itmFileQuit);
|
||||
|
||||
mnuBarMain := TMenuBar.Create(self);
|
||||
{
|
||||
mnuBarMain.Height := 25;
|
||||
mnuBarMain.Width := Width;
|
||||
mnuBarMain.Top := 0;
|
||||
mnuBarMain.Left := 0;
|
||||
}
|
||||
mnuBarMain.Show;
|
||||
|
||||
mnuBarMain.AddMenu('File',mnuFile);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TForm1.mnuQuitClicked(Sender : TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
Close;
|
||||
end;
|
||||
{------------------------------------------------------------------------------}
|
||||
|
||||
|
@ -25,7 +25,7 @@ unit HelloForm;
|
||||
|
||||
interface
|
||||
|
||||
uses SysUtils, Classes, Forms, Buttons, Controls, Graphics;
|
||||
uses SysUtils, Classes, Forms, Buttons;
|
||||
|
||||
type
|
||||
THello = class(TForm)
|
||||
@ -63,24 +63,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure THello.button1Click(Sender : TObject);
|
||||
var
|
||||
Bitmap : TBitmap;
|
||||
S : TFileStream;
|
||||
Dir : String;
|
||||
begin
|
||||
Dir := '..' + PathDelim + 'Images' + PathDelim;
|
||||
With TPixmap.Create do begin
|
||||
LoadFromFile(Dir + 'splash_logo.xpm');
|
||||
S := TFileStream.Create(Dir + 'splash_logo.bmp', fmCreate or fmOpenWrite);
|
||||
SaveToStream(S);
|
||||
S.Free;
|
||||
end;
|
||||
Bitmap := TBitmap.Create;
|
||||
Bitmap.LoadFromFile(Dir + 'splash_logo.bmp');
|
||||
S := TFileStream.Create(Dir + 'splash_logo.bmp', fmCreate or fmOpenWrite);
|
||||
Bitmap.SaveToStream(S);
|
||||
S.Free;
|
||||
Bitmap.Free;
|
||||
close;
|
||||
end;
|
||||
|
||||
@ -89,6 +72,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.7 2002/10/30 13:44:29 lazarus
|
||||
MG: fixed examples
|
||||
|
||||
Revision 1.6 2002/10/29 19:33:42 lazarus
|
||||
MG: removed interfaces
|
||||
|
||||
|
@ -268,7 +268,7 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TForm1.mnuQuitClicked(Sender : TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
Close;
|
||||
end;
|
||||
{------------------------------------------------------------------------------}
|
||||
|
||||
|
@ -2870,7 +2870,7 @@ end;
|
||||
|
||||
procedure TForm1.QuitClick(Sender : TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
Close;
|
||||
end;
|
||||
|
||||
Destructor TForm1.Destroy;
|
||||
@ -2879,6 +2879,9 @@ begin
|
||||
end;
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 2002/10/30 13:44:29 lazarus
|
||||
MG: fixed examples
|
||||
|
||||
Revision 1.9 2002/10/29 08:22:33 lazarus
|
||||
MG: added interfaces unit
|
||||
|
||||
|
@ -289,7 +289,7 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TForm1.mnuQuitClicked(Sender : TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
Close;
|
||||
end;
|
||||
{------------------------------------------------------------------------------}
|
||||
|
||||
@ -300,6 +300,9 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 2002/10/30 13:44:29 lazarus
|
||||
MG: fixed examples
|
||||
|
||||
Revision 1.6 2002/10/30 12:37:25 lazarus
|
||||
MG: mouse cursors are now allocated on demand
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user