|
Copyright ® ( 1997-2008) EDMGROUP Pty Ltd - EZY Prolog Reference |
This domains describes values of the GUI element and layouts.
EZY_REPLY = ezy_reply(
SLIST ADDRESS, /*
address of GUI element */
EZY_ITEM
/* GUI element data */)
EZY_RESULTS = EZY_REPLY*
Briefly, this domain stores addressing information of the GUI element and it's data. What is important, it can be used for individual GUI elements as well as for complex GUI layouts.
EZY_REPLY is the main "communication" bridge between prolog program and GUI elements in form of EZY_ITEM.
Every GUI element has it's corresponding EZY_ITEM domain:
EZY_ITEM =
% Strings: text editor,
edit field
ezy_string(STRING);
% Integers: selected item
of the radio buttons
ezy_integer(INTEGER);
% describes data from compound
GUI elements
ezy_tab(INTEGER TABID, STRING TABNAME,EZY_RESULTS);
ezy_caption(EZY_TEXT,EZY_RESULTS);
% data from external EZY
form
ezy_form(STRING FORM_FILENAME, EZY_RESULTS);
% GRID
ezy_grid(EZY_GRID_INIT_LIST);
% List Boxes
ezy_slist(SLIST ITEMS, ILIST SELECTED_ITEMS);
% List Edit
ezy_slist_edit(STRING, SLIST ITEMS, ILIST SELECTED_ITEMS);
% Complex List
ezy_complex_list(INTEGER SELECTED_ITEM, INTEGER ITEM_SIZE, EZY_LIST_ITEM,EZY_LIST);
% Property Sheet
ezy_property(Property_Sheet);
% Tree
ezy_tree(ILIST POSITION_SELECTED, SLIST MEMBERS_SELECTED, BROWSELIST_ITEM);
% Xtree
ezy_xtree(EZY_LIST_ITEM SELECTED, EZY_XTREE);
% Toolbar
ezy_toolbar(control_list);
% empty reply
ezy_none
How to use EZY_REPLY?
Creating dialog from EZY Form
You can pass dialog parameters via EZY_RESULTS list.
The following code opens EZY FORM as dialog, sends EZY_RESULTS list
as input parameter and returns results as EZY_RESULTS.
syspath(EXEPATH,_),
format(FORM_FILE,"%ssamples\\ezy_forms_test.ezy",EXEPATH),
ezy_dialog_create(FORM_FILE,IN,OUT),
Closing of the EZY Form
The following code (generated automatically by EZY GUI Expert) performs
action, when user presses "OK" button in the dialog.
This code gets results of the whole form by calling ezy_object_data and calls dialog
destruction ezy_dialog_destroy, passing this
results as return parameter.
handler_ok(_,e_control(_,_,CTRLWIN,activated),0):-
TOP_FRAME_ADDRESS = ["TOP_FRAME"],
ezy_object_data(CTRLWIN,TOP_FRAME_ADDRESS,VALUE_TOP_FRAME),
% Destroy dialog and return
Values
ezy_dialog_destroy([VALUE_TOP_FRAME]),!.
How to construct EZY_REPLY domain?
The structure of the domain could be very complex and EZY Prolog has tools to make it very EZY...
Use EZY GUI Expert to generate EZY_REPLY domain for selected GUI element:
Select GUI element in control Tree
Use object inspector and click on Init Code....
System will open text editor with generated prolog code, which has EZY_REPLY for the selected control. Generated code will have necessary comments for easy interpretation of the term.
Example of initialization code, generated by EZY Prolog for list box:
/* USE THIS CODE TO SET VALUES
OF {list box} ELEMENT */
ADDRESS_list_box = ["TOP_FRAME","list box"],
INIT_list_box =
ezy_reply(["TOP_FRAME","list box"],
ezy_slist(
["Item1","Item2","Item3"],/* SLIST */
[]/* ILIST_SELECTED */
) /* EZY_ITEM */
) /*
end of the ezy_reply */,
ezy_object_data(CTRLWIN,ADDRESS_list_box,INIT_list_box),
Use text editor to modify code and paste this code into your program.
How to get information from EZY_REPLY domain?
Use EZY GUI Expert to generate EZY_REPLY domain for selected GUI element:
Select GUI element in control Tree
Use object inspector and click on Return Code....
System will open text editor with generated prolog code, which has EZY_REPLY term for the selected control. Generated code will have necessary comments for easy interpretation of the term.
Example:
/* USE THIS CODE TO RECEIVE
VALUES FROM {list box} ELEMENT */
ADDRESS_list_box = ["TOP_FRAME","list box"],
ezy_object_data(CTRLWIN,ADDRESS_list_box,INIT_list_box),
INIT_list_box =
ezy_reply(["TOP_FRAME","list box"]/*ADDRESS*/,
ezy_slist(
SLIST_0/* SLIST */,
SELECTED_0/* ILIST_SELECTED
*/
) /* EZY_ITEM */
) /*
end of the ezy_reply */,
Note: after term unification variable SLIST_0 will be bound to the values of list box, and SELECTED_0 will be bound to the list of selected indexes of the list box.
Use text editor to modify code and paste this code into your program.
Copyright © 1997-2008 EDMGROUP (Australia)