I am trying to print a function result via pressing a button in XPCE. Here is my code:
/* 11) Max square */
max_square(M, A) :-
findall(P, country(A, P, _, _), L),
write('Max square in thousands km^2: '),
aggregate(max(E), member(E, L), M),
write(M),
forall(country(A, M,_, _),format(',~w~n', [A])).
:- use_module(library(pce)).
test:-
new(D, dialog),
new(W, window('Test', size(100, 100))),
send(D, append, new(button(B, max_square, message(@prolog, max_square, M, A)))),
send(D, below, W),
send(D, open),
!.
But I have such error: https://i.stack.imgur.com/8C1sK.jpg How could I fix it? And my second queston is: is it possible to print this result just in dialog window? Thanks in advance.
This is an example of what can be done