Création de formes en continu
Bonjour à tous,
marre des calendriers, météo, horloge et puzzle etc...
j'ai un projet à développer qui consiste à offrir à certains agents (seven 32 ou 64 bits) d'un service, des outils adaptés (beaucoup..)
à leur activité professionnelle et de loisirs (eh oui..ça évolue de ce côté..)
une sorte de couteau suisse d'un modèle très particulier.
ça commence comme ça sous D7
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
BPlus: TButton;
BCroix: TButton;
procedure BPlusClick(Sender: TObject);
procedure BCroixClick(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
f: TForm;
bt1, bt2: TButton;
const
ecart = 20;
implementation
{$R *.dfm}
procedure CloseForm;
begin
if f <> nil then
f.Close
else
Form1.Close;
end;
procedure AddForm;
begin
f := TForm.Create(Form1);
with Form1 do
begin
f.Color := Color;
f.Left := Left - (Width + ecart);
f.Height := Height;
f.Width := Width;
f.Top := Top;
bt1 := TButton.Create(f);
bt1.Parent := f;
bt1.Left := BPlus.Left;
bt1.Top := BPlus.Top;
bt1.width := BPlus.width;
bt1.height := BPlus.height;
bt1.OnClick := BPlus.OnClick;
bt2 := TButton.Create(f);
bt2.Parent := f;
bt2.Left := BCroix.Left;
bt2.Top := BCroix.Top;
bt2.width := BCroix.width;
bt2.height := BCroix.height;
bt2.OnClick := BCroix.OnClick;
end;
f.Show;
end;
procedure TForm1.BPlusClick(Sender: TObject);
begin
AddForm;
end;
procedure TForm1.BCroixClick(Sender: TObject);
begin
CloseForm;
end;
end. |
je n'ai pas encore mis toutes les instructions.
les formes seront sans bordures, sans bouton, mais auront des menus sur clic-droit.
je démarre juste le programme..
Certains y verront le début du pense-bête de Windows, et ils n'auront pas tort.
mais la comparaison s'arrête là..
je souhaiterais pouvoir fermer chaque forme avec son bouton "X".
la procédure CloseForm ne marche pas bien.
et je voudrais éviter de nommer chaque fiche créée..
avez-vous une solution ?
cantador