From joao.mariz@mail.ineti.pt Fri May 18 21:07:53 2001
Received: from mail.ineti.pt (ettn.ineti.pt [193.136.150.130])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f4IJ7q308753
	for <prolog@swi.psy.uva.nl>; Fri, 18 May 2001 21:07:52 +0200 (MET DST)
Received: from mail.ineti.pt (pc_4.ineti.pt [193.136.150.120]) by mail.ineti.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13)
	id LD37H0G9; Fri, 18 May 2001 20:05:10 +0100
Message-ID: <3B05750B.88CC0EB9@mail.ineti.pt>
Date: Fri, 18 May 2001 20:16:27 +0100
From: =?iso-8859-1?Q?Jo=E3o?= Mariz <joao.mariz@mail.ineti.pt>
X-Mailer: Mozilla 4.72 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
To: Swi-PROLOG usergroup <prolog@swi.psy.uva.nl>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: [SWIPL] Newbie question for XPCE

Hello SwiProlog users;

I have done some work with SWI PROLOG. Now I am trying to do something
with XPCE so that my application becames more pretty.
I have developped a simple predicate [called city/0] that selectes text
from a list. I write it above:

city:-
       new(C, dialog('Select a City')),
       send(C, append, new(LB, list_browser)),
       send(LB, width,  28),
            add_cities(LB),
       send(C, append,
                   new(Bts, dialog_group('Options')), below),
       send(Bts, append, button(quit, message(C, destroy))),
       send(Bts, append, button(ok, message(@prolog, listar,
LB?selection?key, C), right )),
       send(C, open) .

listar(L, C):-
       get(L, name, Text_item),
       nl,  nl,  write('The city is '), write(Text_item), nl, nl,
       send(C, destroy) .

add_cities(LB):-
        send(LB, append, new(Ti1, text_item('Abrantes', 'Abrantes'))),
        send(LB, append, new(Ti2, text_item('Coimbra', 'Coimbra'))),
        send(LB, append, new(Ti3, text_item('Lisboa', 'Lisboa'))),
        send(LB, append, new(X1, text_item('Golegă', 'golega'))),
        send(LB, append, new(X2, text_item('Salva Terra de Magos',
'salva terra de magos'))),
        send(LB, append, new(Xl3, text_item('Chamusca',  'chamusca'))),
        send(LB, append, new(X4, text_item('Santarém',  'santarem'))),
        send(LB, append, new(S1, text_item('Porto', 'porto'))),
        send(LB, append, new(B2, text_item('Faro', 'faro'))),
        send(LB, append, new(N3, text_item('Évora',  'evora'))),
        send(LB, append, new(C4, text_item('Beja',  'beja'))), ! .

However, after querying with city/0 predicate, when I select both, the
text from the list_browser and the ok button, I do not get a "yes"
answer on my XPCE ?- prompt. Perhaps I did not finnish city/0 predicate.

If I have a city/0 predicate inside another predicate I get the answer
"no" at the XPCE '- prompt and I still have my XPCE window open.
How can I have a Yes answer? or pursuit with the city/0 predicate until
it finnishes?

Thanks in advance for any help you can provide,

Joăo

