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