Can anyone help?
I have created an interface in prolog using the dialog editor in the Run menu. I am now trying to join my code into it but a having a few problems.
To start with i have a list box with provides three choices. I have it now reading which choice is selected but i cannot get the program to execute the code inside the choices. An example is:
user_handler( (user_dialog,1000),_,button_down,_):-
wtext( (user_dialog,8000),Mode), assert(mode(Mode)),
wtext( (user_dialog,8001),Start), assert(start(Start)),
wtext( (user_dialog,8002),End), assert(end(End)),
wtext( (user_dialog,8003),Day), assert(day(Day)),
get_lbx_selection( (user_dialog,4000), [Selected_Item]),
write(Selected_Item),nl,write(Mode),nl,write(Start),nl,write(End),nl,write(Day),
choice(Selected_Item).
I want to read what is entered in edit boxes and assign them to variables which i can use throughout the program. I am trying to use assert but it deosn't appear to be working.
choice(`towns`):- start(Start),end(End),
getroute(Start,[End],Route).
route(Route),
wtext((user_dialog,8004),Route),
retractall(route(_)).
Get route is as such and works without the interface present.
getroute(Start,[Start|Rest],[Start|Rest]).
getroute(Start,[City|Rest],Route):-
adjacent(Next,City),not on(Next,Rest),
getroute(Start,[Next,City|Rest],Route),
assert(route(Route)),
wtext((user_dialog,8007),Route),write(Route),nl,retractall(route(_)).
getroute(Start,[City|Rest],Route):-
adjacent(City,Next),not on(Next,Rest),
getroute(Start,[Next,City|Rest],Route),
assert(route(Route)),
wtext((user_dialog,8007),Route),write(Route),nl,retractall(route(_)).
I appreciate any help
Thanks
Deirdre
I have created an interface in prolog using the dialog editor in the Run menu. I am now trying to join my code into it but a having a few problems.
To start with i have a list box with provides three choices. I have it now reading which choice is selected but i cannot get the program to execute the code inside the choices. An example is:
user_handler( (user_dialog,1000),_,button_down,_):-
wtext( (user_dialog,8000),Mode), assert(mode(Mode)),
wtext( (user_dialog,8001),Start), assert(start(Start)),
wtext( (user_dialog,8002),End), assert(end(End)),
wtext( (user_dialog,8003),Day), assert(day(Day)),
get_lbx_selection( (user_dialog,4000), [Selected_Item]),
write(Selected_Item),nl,write(Mode),nl,write(Start),nl,write(End),nl,write(Day),
choice(Selected_Item).
I want to read what is entered in edit boxes and assign them to variables which i can use throughout the program. I am trying to use assert but it deosn't appear to be working.
choice(`towns`):- start(Start),end(End),
getroute(Start,[End],Route).
route(Route),
wtext((user_dialog,8004),Route),
retractall(route(_)).
Get route is as such and works without the interface present.
getroute(Start,[Start|Rest],[Start|Rest]).
getroute(Start,[City|Rest],Route):-
adjacent(Next,City),not on(Next,Rest),
getroute(Start,[Next,City|Rest],Route),
assert(route(Route)),
wtext((user_dialog,8007),Route),write(Route),nl,retractall(route(_)).
getroute(Start,[City|Rest],Route):-
adjacent(City,Next),not on(Next,Rest),
getroute(Start,[Next,City|Rest],Route),
assert(route(Route)),
wtext((user_dialog,8007),Route),write(Route),nl,retractall(route(_)).
I appreciate any help
Thanks
Deirdre