addressApp.p
1 |
define button ExitButton label "Exit". |
---|---|
2 |
define button AddButton label "Add". |
3 |
define button FindButton label "Find". |
4 |
define var target like Address.city. |
5 |
|
6 |
/**Frame Address**/ |
7 |
|
8 |
define frame AddrFrame |
9 |
Address.addr-id at row 2 col 2 |
10 |
Address.addr-type at row 2 col 40 |
11 |
target at row 4 col 2 |
12 |
Address.state at row 4 col 40 |
13 |
Address.street at row 6 col 2 |
14 |
Address.zip-code at row 8 col 2 |
15 |
AddButton at row 10 col 2 |
16 |
FindButton at row 10 col 20 |
17 |
ExitButton at row 10 col 40 |
18 |
with side-labels centered row 2 title "Address Form". |
19 |
/**Triggers**/ |
20 |
on choose of AddButton |
21 |
do: |
22 |
create Address. |
23 |
assign Address except Address.city. |
24 |
assign Address.city=target. |
25 |
display Address except Address.city with frame AddrFrame. |
26 |
end. |
27 |
on choose of FindButton |
28 |
do: |
29 |
assign target. |
30 |
find first Address where Address.city = target no-error. |
31 |
if available(Address) |
32 |
then do: |
33 |
display Address except Address.city with frame AddrFrame. |
34 |
end. |
35 |
else do: Message "Couldn't find " + target |
36 |
view-as alert-box title "Warning.". |
37 |
end. |
38 |
|
39 |
end. |
40 |
|
41 |
find first Address. |
42 |
if available(Address) |
43 |
then target = Address.city. |
44 |
|
45 |
display Address except Address.city with frame AddrFrame. |
46 |
|
47 |
enable all with frame AddrFrame. |
48 |
wait-for choose of ExitButton. |