I have a dialog which contains multiple text item elements and a button. How can i retrieve the values and use them?
new(D, dialog('Add a recipe')),
send(D, append(new(NameItem, text_item('Name')))),
send(D, append(new(InstItem, text_item('Instruction')))),
send(D, append(new(IngrItem, text_item('Ingredients')))),
send(D, append(new(TimeItem, text_item('Time')))),
send(D, append(button('Store', message(D, return, '1')))),
get(D, confirm, Rvalue),
write(NameItem), nl,
write(InstItem), nl,
write(IngrItem), nl,
write(TimeItem), nl,
free(D),
test :-
new(D, dialog('Add a recipe')),
send(D, append(new(NameItem, text_item('Name')))),
send(D, append(new(InstItem, text_item('Instruction')))),
send(D, append(new(IngrItem, text_item('Ingredients')))),
send(D, append(new(TimeItem, text_item('Time')))),
send(D, append(button('Store', message(D, return, '1')))),
send(D, show(true)),
get(D, confirm, _Rvalue),
maplist(getv, [NameItem, InstItem, IngrItem, TimeItem]),
free(D).
getv(T) :- get(T, selection, V), writeln(V).
you can process a list altogether, applying to each element (a textitem object) a 'get text' operation