2012-12-21 62 views

回答

2

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应该得到(我填一些值)

enter image description here

,并单击控制台Create输出

Creating male person goofy of 99 years old 

一般来说,您需要attach你的按钮到一些GUI来获得它们的功能。

HTH

编辑这里的布局,我得到的Windows

enter image description here

没有在方式获得那些2幅图像的差异:在Windows中我有上下文菜单打开帮助主题后激活Consult

+0

对于Windows 7,我没有得到这种设计的对话框,你使用的操作系统是什么? – joel76

+0

@ joel76:Linux,但XPCE应该是完全可移植的。我现在试试Vista吧...... – CapelliC