So, I am writing a bus schedule app.
I have this form where you have to tell departure point, destination point and a day and when you click on "Resluts" button, it should return all buses numbers and time of their departure and write it to the Results edit control.
so i have a predicate (private)
Code: Select all
route:(string DepCity, string DestCity, day Day, stops Stops)nondeterm anyflow.
Code: Select all
route(P1,P2,Day,[stop(Number,P1,P2,DepTime)]):-
tripschedule(P1,P2,Number,DepTime,_,Day).
route(P1,P2,Day,[stop(Number,P1,P15, DepTimeP1)|Route]):-
tripschedule(P1,P15,Number,DepTimeP1,ArrTimeP15,Day),
route(P15, P2, Day, Route),
setdeparturetime(Route,DepTimeP2),
transfer(ArrTimeP15,DepTimeP2).
Code: Select all
stop = stop(integer TripNum, string DepCity, string DestCity, time TimeOfTr).
stops = stop*.
Code: Select all
time = time(integer Hour, integer Minutes)
Code: Select all
onResButtonClick(_Source) = button::defaultAction():-
P1=src_ctl:getText(),
P2 = dir_ctl:getText(),
Day = wkday_ctl:getText(),
sp::resultpredicate(P1,P2,Day,Output), %idk how to write this predicate
res_ctl:setText(Output).
It was easier to do in the console mode using fail, but I have no idea how to do it with GUI. Is it even possible?