又来求助了。。
prolog吧
全部回复
仅看楼主
level 5
OK按钮的程序:
predicates
onOkClick : button::clickResponder.
clauses
onOkClick(_Source) = button::defaultAction:-
ID=id_ctl:getText(),
codedatabase::findCode(ID,Xianxiang,Why,Solution),
xianxiang_ctl:setText(""),
why_ctl:setText(""),
solution_ctl:setText(""),
xianxiang_ctl:setText(Xianxiang),
why_ctl:setText(Why),
solution_ctl:setText(Solution),!.
然后再codedatabase里.cl声明了findCode:(string ID,string Xianxiang, string Why, string Solution)determ(i,o,o,o).
在codedatabase.pro中,
class facts
code:(string ID, string Xianxiang, string Why, string Solution).
clauses
findCode(ID,Xianxiang,Why,Solution):-
code(ID,Xianxiang,Why,Solution),!.
然后运行时候出错了,不知道怎么改。。求助
错误代码是:
class facts
code:(string ID, string Xianxiang, string Why, string Solution).
2013年05月08日 07点05分 1
level 5
@真实之魇 求帮助。。
2013年05月08日 07点05分 2
level 5
额。。错误代码粘错了。。大概是ok按钮那里,which is declared procedure,is also determ.
2013年05月08日 07点05分 3
level 5

findCode(ID,Xianxiang,Why,Solution):-
code(ID,Xianxiang,Why,Solution),!.
findCode(ID,Xianxiang,Why,Solution):-
Xianxiang="error",
Why="error",
Solution="error".
stdIO::write("请重新输入"),stdIO::nl.
你看,我在下面有加了这些代码,但是一运行还是错的啊,求帮助检查。。
2013年05月08日 13点05分 5
回复 真实之魇 :把标点改了可是还是会出错啊
2013年05月09日 06点05分
回复 真实之魇 :这个已经可以运行了,谢谢了~~就是在操作那个查询界面的时候输入了一个数,接着点那个按钮,然后那个界面就消失了。。我还得看看控件什么的详细操作。。
2013年05月09日 06点05分
level 5
又有程序运行错了,麻烦你帮我看一下。。
那个电源模块是checkpower_ctl右边那个listedit控件的名字是power_ctl。
我想实现的功能是点击电源模块那个控件时,后边能出现知识库中相应的电源模块的一些现象。知识库的内容是:(那个0就是代表电源模块)
class facts
information:(integer ID,string Explain).
class facts
manage:(string Xianxiang,string Why,string Solution).
clauses
fillDatabase():-
assert(information(0,"+5V 电压")),
assert(information(0,"CPU 模块上的报警指示灯亮红灯")),
assert(manage("+5V 电压","电源模块损坏;CNC 内部电源存在过载","更换电源模块")),
stdIO::write("Database has been filled"), stdIO::nl.
现在那个电源模块控件的代码是这样的:
predicates
onCheckBoxStateChanged : checkButton::stateChangedListener.
clauses
onCheckBoxStateChanged(_Source, _OldState, _NewState):-
Power= checkpower_ctl: getChecked() ,
data::getpowerlist(Powerlist),
if (Power=true ) then
power_ctl:addList(Powerlist)
else
power_ctl:setText("")
end if.
getpowerlist(Powerlist)谓词的定义如下:
predicates
getpowerlist:(string* Powerlist)procedure(o).
clauses
getpowerlist(Powerlist):-
findAll(Power,information(0,Power),Powerlist).
在调试时候没有出错,但是运行之后点击那个电源模块,后面没反应,不知道为什么。。求解答@真实之魇
2013年05月15日 08点05分 7
1