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
|
program console_02;
uses
Flash8, Couleurs;
{$FRAME_WIDTH 600}
{$FRAME_HEIGHT 400}
{$BACKGROUND $4169E1}
const
nomPrg = 'Console.'#13
+ 'Programme FlashPascal.';
invite = 'Votre mot ?';
type
TEditBox = class(TextField)
procedure onKeyDown;
end;
var
e: TEditBox;
t1, t2, t3: TextField;
f1: TextFormat;
sw, sh: Number;
procedure TEditBox.onKeyDown;
begin
if Key.getAscii = 13 then
begin
t3.text := 'Votre mot est "' + e.text + '".';
end;
end;
begin
f1 := TextFormat.Create('Courier New', 13);
sw := Stage.Width;
sh := Stage.Height;
t1 := TextField.Create(_root, 'nomPrg', 0, 0, 0*18, sw-1, 2*18);
t1.setNewTextFormat(f1);
t1.text := nomPrg;
t2 := TextField.Create(_root, 'invite', 1, 0, 2*18, sw-1, 1*18);
t2.setNewTextFormat(f1);
t2.text := invite;
e := TEditBox.Create(_root, 'I', 2, 0, 3*18, sw-1, 1*18);
e.setNewTextFormat(f1);
e.type := 'input';
e.backgroundColor := Snow;
e.background := true;
e.borderColor := LightSteelBlue;
e.border := true;
Selection.setFocus(e);
Key.addListener(e);
t3 := TextField.Create(_root, 'O', 3, 0, 4*18, sw-1, sh-4*18);
t3.SetNewTextFormat(f1);
t3.text := '';
_root.opaqueBackground := WhiteSmoke;
stage.scaleMode := 'noScale';
end. |
Partager