There is a huge temoral issue here: The class facts exists all the time, the editor controls only some of the time. Furthermore the text in the edit controls chages while the user edits.
So you must ask your self
when should these values be transferred from the edit controls an into the facts.
Assuming that you want it to happen when the user presses
OK in the dialog.
To do this you must attach a click-listener to the OK button:
- Select the button in the dialog editor
- In the Events tab in the Properties editor: write onOkClick next to the ClickResponder entry (fiunish with enter).
This should give you code like this:
Code: Select all
predicates
onOkClick : button::clickResponder.
clauses
onOkClick(_Source) = button::defaultAction.
And in this code you can assert the relevant facts:
Code: Select all
predicates
onOkClick : button::clickResponder.
clauses
onOkClick(_Source) = button::defaultAction :-
assert(edge("A","B",edit_ctl:getText())),
assert(edge("A","C",edit1_ctl:getText())).