1
?- new(B, button(hello,
message(@pce, write_ln, hello))).
在xpce /序言,这种方式创建一个按钮,打印一句 有没有什么办法,当我点击一个按钮,我想要做的一些功能,请帮忙!如何创建一个按钮做一些功能xpce/Prolog的
?- new(B, button(hello,
message(@pce, write_ln, hello))).
在xpce /序言,这种方式创建一个按钮,打印一句 有没有什么办法,当我点击一个按钮,我想要做的一些功能,请帮忙!如何创建一个按钮做一些功能xpce/Prolog的
从Help > XPCE manual > Browsers > Examples > Obtainers
+右键点击+ Select
你可以看到一个实际的例子。
create_person_dialog :-
new(D, dialog('Enter new person')),
send(D, append, new(label)), % for reports
send(D, append, new(Name, text_item(name))),
send(D, append, new(Age, text_item(age))),
send(D, append, new(Sex, menu(sex, marked))),
send(Sex, append, female),
send(Sex, append, male),
send(Age, type, int),
send(D, append,
button(create, message(@prolog, create_person,
Name?selection,
Age?selection,
Sex?selection))),
send(D, default_button, create),
send(D, open).
create_person(Name, Age, Sex) :-
format('Creating ~w person ~w of ~d years old~n',
[Sex, Name, Age]).
开放的亮点create_person_dialog
后,右键单击并Consult
应该得到(我填一些值)
,并单击控制台Create
输出
Creating male person goofy of 99 years old
一般来说,您需要attach
你的按钮到一些GUI来获得它们的功能。
HTH
编辑这里的布局,我得到的Windows
没有在方式获得那些2幅图像的差异:在Windows中我有上下文菜单打开帮助主题后激活Consult
。
对于Windows 7,我没有得到这种设计的对话框,你使用的操作系统是什么? – joel76
@ joel76:Linux,但XPCE应该是完全可移植的。我现在试试Vista吧...... – CapelliC