2012-12-21 59 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