so I'm working on an SWI-Prolog code, basically this search_restaurant will give names of restaurant with the criteria given.
So if I execute
search_restaurant(500,300,9,7500,seafood,knowledge_based,X).
result:
seafood restaurant with coord 500, 300 estimated price 7500 and rating 9: [ABCRest].
X = [ABCRest].
The code:
search_restaurant(Xcoord,Ycoord,DesiredRating,DesiredPrice,DesiredType,Kbfile,RestaurantName) :- kbFile(Kbfile),
processInput(Xcoord, Ycoord, DesiredRating, DesiredPrice, DesiredType, RestaurantName),
format('~w restaurant with coord ~d, ~d estimated price ~w and rating ~d: ~w',
[DesiredType, Xcoord, Ycoord, DesiredPrice, DesiredRating, RestaurantName]).
Now I'm trying to implement XPCE Gui to input the variables, here's my code:
start :-
new(D, dialog('ZOMITO', size(800, 800))),
new(H1, dialog_group(' ')),
new(H2, dialog_group(' ')),
send(D, append, H1),
send(D, append, H2),
send(H1, append, new(Kbfile, text_item('Input knowledge based file name:'))),
new(Xcoord, text_item('Input your location coordinate(x):')),
new(Ycoord, text_item('Input your location coordinate(y)')),
new(DesiredRating, text_item('Input your desired rating (ex:2 to 4):')),
new(DesiredPrice, text_item('Input your desired price range (ex:100000 to 200000):')),
new(DesiredType, text_item('Input your desired restaurant type (ex:javanese):')),
new(RestaurantName, text_item('Input your desired restaurant name:')),
send(H2, append, Xcoord),
send(H2, append, Ycoord),
send(H2, append, DesiredRating),
send(H2, append, DesiredPrice),
send(H2, append, DesiredType),
send(H2, append, RestaurantName),
send(Xcoord, type, int),
send(Ycoord, type, int),
send(D, append,
button(search, message(@prolog, search_restaurant,
Xcoord?selection,
Ycoord?selection,
DesiredRating?selection,
DesiredPrice?selection,
DesiredType?selection,
Kbfile?selection,
RestaurantName?selection))),
send(D, default_button, search),
send(D, open).
But it doesn't show up in the console as if I call the search_restaurant manually. Any help? What am I missing? Thank you!