| Did you know ... | Search Documentation: |
| Obtainers |
Primitive usage of obtainers
These examples presents some elementary ways to use obtainers. The same mechanism applies to other function objects.
% Prolog has no functions, PCE does:
make_same_width(Gr1, Gr2) :-
send(Gr1, width, Gr2?width).
% Pick up arguments from a dialog window:
create_person_dialog :-
new(D, dialog('Enter new person')),
send(D, append, new(label)), % for reports
send(D, append, new(Name, text_item(name))),
send(D, append, new(Age, text_item(age))),
send(D, append, new(Sex, menu(sex, marked))),
send(Sex, append, female),
send(Sex, append, male),
send(Age, type, int),
send(D, append,
button(create, message(@prolog, create_person,
Name?selection,
Age?selection,
Sex?selection))),
send(D, default_button, create),
send(D, open).
create_person(Name, Age, Sex) :-
format('Creating ~w person ~w of ~d years old~n',
[Sex, Name, Age]).
% Start the demo
:- create_person_dialog.
<-get_catch_all <-member <-get_catch_all