Next: Messages to the user
Up: Dialog categories
Previous: Dialog categories
prompt_read(Prompt_list, Term)
ask(Prompt_list,Input)
- Both are modeless dialogs - with an edit field into which the required
term is to be entered
- Prompt_list is the sentence displayed within the dialog, and Term
is the variable to which the input of the user is bound
- If the user simply presses return - or clicks on the OK button, Term
is bound to the built in end_of_file.
read1 :-
prompt_read(['Enter a likes clause'],Clause).
read2(Name, Feeling) :-
ask(['How are you,', Name, ?],Feeling),
write(Feeling).
Figure 1: Prompt dialog
Figure 2: Ask dialog
- For the ask dialog, no syntax checks are made on the input
- The Input argument - in the example this is the variable Feeling
will be bound to a list of tokens entered in the edit field, hence :
Feeling =
['A', little, dizzy, from, last, night, ',',
but,'OK','I',guess]
- This can then be processed by the calling program (as required).
menu(Music) :-
scroll_menu(['What music do you like ?'],
['Pop','Indie','Jazz','Metal','Punk',
'Fusion','Classical','Reggae','Dance'],
['Jazz'], Music).
- Displays a scrolling menu for selecting one or more
items
- The menu dialog is modal
- The general form is :
scroll_menu(Prompt,Menu_list,Preselected,Selected)
- Prompt refers to the question asked from the user,
Menu_list corresponds to the different choices offered,
Preselected is the item highlighted when the menu is invoked
and Selected is a variable containing the choices made by the
user
- In the above example, if the user selected Jazz, then
Music = ['Jazz']
- If multiple options were selected (by holding down the shift key
and pressing the mouse button), then
Music = ['Metal','Punk','Dance']
- If the atom 'Jazz' instead of the list
['Jazz']
was the Preselected argument in the example, then only
ONE option would be selectable from the menu list
Figure 3: Dialog Menu
question1 :-
yesno(['Is the moon green',?]).
question2 :-
myesno(['Have you switched off the gas',?]).
Figure 4: The Modeless yes/no dialog
Figure 5: The Modal yes/no dialog
Next: Messages to the user
Up: Dialog categories
Previous: Dialog categories
Omer F Rana
Mon Mar 17 12:45:35 GMT 1997