Skip to content

Commit

Permalink
POO (suite)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillou58 committed Jun 27, 2015
1 parent e2235e6 commit 003528f
Show file tree
Hide file tree
Showing 60 changed files with 2,907 additions and 0 deletions.
Binary file added docs/Conventions utilisées.docx
Binary file not shown.
Binary file modified docs/FAQ.docx
Binary file not shown.
Binary file modified docs/TOUT.docx
Binary file not shown.
Binary file modified docs/TOUT.pdf
Binary file not shown.
Binary file modified done/poo/Les propriétés.docx
Binary file not shown.
36 changes: 36 additions & 0 deletions done/poo/exemples/PO_12/main.lfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
object MainForm: TMainForm
Left = 254
Height = 240
Top = 150
Width = 478
Caption = 'Test des messages'
ClientHeight = 240
ClientWidth = 478
LCLVersion = '1.4.0.4'
object edtDummy: TEdit
Left = 24
Height = 23
Top = 24
Width = 80
OnChange = edtDummyChange
TabOrder = 0
Text = 'A changer...'
end
object mmoDisplay: TMemo
Left = 232
Height = 200
Top = 24
Width = 232
ScrollBars = ssAutoBoth
TabOrder = 1
end
object btnLost: TButton
Left = 24
Height = 25
Top = 199
Width = 75
Caption = 'Perdu !'
OnClick = btnLostClick
TabOrder = 2
end
end
112 changes: 112 additions & 0 deletions done/poo/exemples/PO_12/main.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{ |========================================================================|
| |
| Projet : Aller plus loin avec Lazarus |
| Description : POO - Programme exemple 12 |
| Unité : main.pas |
| Site : www.developpez.net |
| Copyright : © Roland CHASTAIN & Gilles VASSEUR 2015 |
| Date: 09/06/2015 14:56:25 |
| Version : 1.0.0 |
| |
|========================================================================| }

// HISTORIQUE
// 09/06/2015 14:56:35 - 1.0.0 - première version opérationnelle

// MAIN - part of "Aller plus loin avec Lazarus"
// Copyright © Roland CHASTAIN & Gilles VASSEUR 2015
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.
// If not, see <http://www.gnu.org/licenses/>.

unit main;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
LMessages;

const
M_CHANGEDMESSAGE = LM_User + 1; // message de changement
M_LOSTMESSAGE = LM_User + 2; // message perdu

type

{ TMainForm }

TMainForm = class(TForm)
btnLost: TButton;
edtDummy: TEdit;
mmoDisplay: TMemo;
procedure btnLostClick(Sender: TObject);
procedure edtDummyChange(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
procedure Changed(var Msg: TLMessage); message M_CHANGEDMESSAGE;
procedure DefaultHandler(var AMessage); override;
end;


var
MainForm: TMainForm;

implementation

{$R *.lfm}

{ TMainForm }

procedure TMainForm.edtDummyChange(Sender: TObject);
// *** l'éditeur signale un changement ***
var
Msg: TLMessage;
begin
Msg.msg := M_CHANGEDMESSAGE; // assignation du message
Dispatch(Msg); // répartition
//Perform(M_CHANGEDMESSAGE, 0, 0); // envoi du message sans queue d'attente
end;

procedure TMainForm.btnLostClick(Sender: TObject);
// *** le bouton envoie un message perdu ***
var
Msg: TLMessage;
begin
Msg.msg := M_LOSTMESSAGE; // assignation du message
Dispatch(Msg); // répartition
//Perform(M_LOSTMESSAGE, 0, 0); // envoi du message sans queue d'attente
end;

procedure TMainForm.Changed(var Msg: TLMessage);
// *** changement récupéré avec numéro du message ***
begin
mmoDisplay.Lines.Add('Changement ! Message : ' + IntToStr(Msg.msg));
end;

procedure TMainForm.DefaultHandler(var AMessage);
// *** message perdu ? ***
begin
// transtypage de la variable sans type en TLMessage
if (TLMessage(AMessage).msg = M_LOSTMESSAGE) then // message perdu ?
mmoDisplay.Lines.Add('Non Traité ! Message : ' + IntToStr(TLMessage(AMessage).msg));
inherited DefaultHandler(AMessage); // on hérite
end;

end.

Binary file added done/poo/exemples/PO_12/testmessages.exe
Binary file not shown.
Binary file added done/poo/exemples/PO_12/testmessages.ico
Binary file not shown.
85 changes: 85 additions & 0 deletions done/poo/exemples/PO_12/testmessages.lpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="testmessages"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="testmessages.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="main"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="testmessages"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>
54 changes: 54 additions & 0 deletions done/poo/exemples/PO_12/testmessages.lpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{ |========================================================================|
| |
| Projet : Aller plus loin avec Lazarus |
| Description : POO - Programme exemple 12 |
| Unité : testmessages.lpr |
| Site : www.developpez.net |
| Copyright : © Roland CHASTAIN & Gilles VASSEUR 2015 |
| Date: 09/06/2015 14:56:25 |
| Version : 1.0.0 |
| |
|========================================================================| }

// HISTORIQUE
// 09/06/2015 14:56:35 - 1.0.0 - première version opérationnelle

// TESTMESSAGES - part of "Aller plus loin avec Lazarus"
// Copyright © Roland CHASTAIN & Gilles VASSEUR 2015
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.
// If not, see <http://www.gnu.org/licenses/>.

program testmessages;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main
{ you can add units after this };

{$R *.res}

begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.

30 changes: 30 additions & 0 deletions done/poo/exemples/PO_12/testmessages.lps
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="9"/>
<BuildModes Active="Default"/>
<Units Count="2">
<Unit0>
<Filename Value="testmessages.lpr"/>
<IsPartOfProject Value="True"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="main"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="-1"/>
<UsageCount Value="20"/>
</Unit1>
</Units>
<General>
<ActiveWindowIndexAtStart Value="-1"/>
</General>
<JumpHistory HistoryIndex="-1"/>
</ProjectSession>
</CONFIG>
Binary file added done/poo/exemples/PO_12/testmessages.res
Binary file not shown.
74 changes: 74 additions & 0 deletions done/poo/exemples/PO_13/main.lfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
object MainForm: TMainForm
Left = 254
Height = 248
Top = 150
Width = 367
ActiveControl = edtNum1
Caption = 'Test de overload'
ClientHeight = 248
ClientWidth = 367
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
LCLVersion = '1.4.0.4'
object edtNum1: TEdit
Left = 136
Height = 23
Top = 15
Width = 80
TabOrder = 0
Text = '22'
end
object edtNum2: TEdit
Left = 136
Height = 23
Top = 48
Width = 80
TabOrder = 1
Text = '78'
end
object lblResult: TLabel
Left = 176
Height = 15
Top = 144
Width = 6
Caption = '0'
ParentColor = False
end
object btnComputeSt: TButton
Left = 48
Height = 25
Top = 88
Width = 75
Caption = 'Chaînes'
OnClick = btnComputeStClick
TabOrder = 2
end
object btnComputeInt: TButton
Left = 232
Height = 25
Top = 88
Width = 75
Caption = 'Entiers'
OnClick = btnComputeIntClick
TabOrder = 3
end
object btnComputeStV: TButton
Left = 48
Height = 25
Top = 162
Width = 75
Caption = 'Chaînes V'
OnClick = btnComputeStVClick
TabOrder = 4
end
object btnComputeIntV: TButton
Left = 232
Height = 25
Top = 162
Width = 75
Caption = 'Entiers V'
OnClick = btnComputeIntVClick
TabOrder = 5
end
end
Loading

0 comments on commit 003528f

Please sign in to comment.