Dear Community,
I have the following problem:
- I have two browser windows, in one browser window I want to append elements from the drop-down menu by clicking the button “Add”. With this task I have no difficulties.
- After getting several elements I would like to be able to choose one of the elements in the browser window and by clicking another button “Select” get several predefined options, depending on the previous choice, in the second browser window. This is what created troubles for me. From what I’ve found there are some operators, such as: “get”, “dict” and "dict_item. However, as I am new to XPCE and I haven’t found clear examples and I am asking for the help from community. The code is as follows:
my_form :-
new(D, dialog('Main window', size(800, 800))),
new(H1, dialog_group(' ')),
send(D, append, H1),
new(ServType, menu(service, cycle)),
send_list(ServType, append, [abcd, efgh, ijkl, mnop]),
send(H1, append, ServType),
new(Brow, browser),
send(H1, append, Brow),
new(Lb, list_browser),
send(H1, append, Lb, right),
send(H1, append,
button(add,
message(@prolog, add_element, ServType?selection, Lb))),
send(H1, append,
button(select,
message(@prolog, add_subelement, ServType?selection, Brow))),
send(D, open).
add_element(ServType, Lb) :-
send(Lb, append, ServType).
add_subelement(ServType, Brow) :-
%get(Lb, )
ServType == abcd,
send_list(Brow, append, [wwww, zzzz, yyyy]);
ServType == efgh,
send_list(Brow, append, [vvvv, qqqq, uuuu]).
start :- my_form.
The core problem is in this part:
add_subelement(ServType, Brow) :-
%get(Lb, )
ServType == abcd,
send_list(Brow, append, [wwww, zzzz, yyyy]);
ServType == efgh,
send_list(Brow, append, [vvvv, qqqq, uuuu]).
Instead of “ServType” I would like to pass the “Lb”, extract the value, check if it corresponds to the set condition and then append some values using “send_list” to the “Brow” browser element.
Thank you for your help!
N.B. I also published this issue on stackoverflow, link: https://stackoverflow.com/questions/62721181/get-value-from-browser-element-in-xpce-prolog