summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/newt/examples/newt3.pas
blob: 59d1a22200e9d333ea351f6fef584727ecc78945 (plain)
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
program newt3;

uses newt;


var

    form, labelC, entry, button : newtComponent;
    S: ansiString;
    P: Pchar;
    machaine :string;
begin

    newtInit();
    newtCls();

    newtOpenWindow(10, 5, 40, 8, 'Entry and Label Sample');

    labelC := newtLabel(1, 1, 'Enter a string');

    p:=addr(machaine[1]);
    s:='Sample';
    entry := newtEntry(16,1,PChar(S),20,@P,NEWT_FLAG_SCROLL OR NEWT_FLAG_RETURNEXIT);


    button := newtButton(17, 3, 'Ok');
    form := newtForm(NiL, NiL, 0);
    newtFormAddComponents(form, labelC, entry, button, NiL);

    newtRunForm(form);

    newtFinished();

    writeln('Final string was:'+ strPas(P));

    (* We cannot destroy the form until after we've used the value
       from the entry widget. *)
    newtFormDestroy(form);
end.