我试图使用 XPCE 在 Prolog 中创建一个界面。我正在使用对话框编辑器,它在 Prolog 中生成了我的代码。当我点击 SUM 按钮时没有任何反应,我不明白为什么,但我认为问题是 sum 子句。
dialog(zbrajanje,
[ object :=
Zbrajanje,
parts :=
[ Zbrajanje :=
dialog('Zbrajanje'),
Unesi :=
button(unesi),
Odustani :=
button(odustani),
Text_item_1 :=
text_item(text_item1),
Text_item_2 :=
text_item(text_item2),
Rezultat :=
text_item('Rezultat')
],
modifications :=
[ Text_item_1 := [ length := 26
]
],
layout :=
[ area(Unesi,
area(52, 148, 80, 24)),
area(Odustani,
area(224, 146, 80, 24)),
area(Text_item_2,
area(66, 39, 260, 24)),
area(Text_item_1,
area(66, 63, 260, 24)),
area(Rezultat,
area(67, 90, 246, 24))
],
behaviour :=
[ SUM := [ message := message(@prolog,
sum,
Text_item_2?selection,
Text_item_1?selection,
Rezultat)
],
EXIT := [ message := message(Zbrajanje, return, @nil)
]
]
]).
sum(X,0,X).
sum(X,Y,S):-
S = X+Y.
inic(Var) :- make_dialog(D,zbrajanje ),
get(D, confirm_centered, R),
send(D,destroy),
Var = R.