|
Copyright ® (1997-2005) EDMGROUP Pty Ltd - EZY Prolog Reference |
|
|
The Xtree control sample consists of 2 components:
DCL file has been created by EZY Designer using standard tools, which allow to create complex Xtree control natively. Sample program demonstrates how to control properties of XTree |
|
|
Xtree test program:
|
predicates
prolog_main
initialize_gui: EZY_INITIALIZE_GUI
% EVENT HANDLERS CODE
initialize_event_handlers(WINDOW)
handler_ok: EHANDLER
handler_cancel: EHANDLER
xtree_ehandler: EHANDLER
clauses
prolog_main():-
/* NOTE - EZY file should reside in EXE directory*/
syspath(EXEPATH,_),
concat(EXEPATH,"",FORMNAME),
ezy_form_open(FORMNAME,initialize_gui,EZY_GUI_RESULT),
write(EZY_GUI_RESULT),nl,!.
% START OF GUI INITIALIZE
initialize_gui(WINDOW):-
write("GUI
initialization started"),nl,
initialize_event_handlers(WINDOW),
% END OF GUI INITIALIZE
write("GUI
Initialization completed"),nl,
!.
initialize_gui(_):-
write("GUI
initialization failed"),nl,
!.
/* EVENT HANDLERS INITIALIZE START*/
initialize_event_handlers(WINDOW):-
OK_ADDR = ["TOP_FRAME","buttons","Ok"],
ezy_object_get(WINDOW,OK_ADDR,OK_WINDOW),
ezy_object_handler(OK_WINDOW,handler_ok),
fail.
initialize_event_handlers(WINDOW):-
CANCEL_ADDR = ["TOP_FRAME","buttons","Cancel"],
ezy_object_get(WINDOW,CANCEL_ADDR,CANCEL_WINDOW),
ezy_object_handler(CANCEL_WINDOW,handler_cancel),
fail.
initialize_event_handlers(WINDOW):-
XTREE_ADDR = ["TOP_FRAME","Xtree"],
ezy_object_get(WINDOW,XTREE_ADDR,XTREE_WINDOW),
ezy_object_handler(XTREE_WINDOW,xtree_ehandler),
fail.
initialize_event_handlers(_):-
write("***
{EVENT HANDLERS Initialised}"),nl,
!.
/* EVENT HANDLERS INITIALIZE END*/
/* OK HANDLER */
handler_ok(_,e_control(_,_,CTRLWIN,activated),0):-
ezy_object_address(CTRLWIN, CTRL_ADDRESS),
write("Button(",CTRL_ADDRESS,") activated"),nl,
dlg_note("handler_ok Button Pressed","Button:[TOP_FRAME.buttons.Ok]"),
% Use GUI Designer menu
{Control to Clipboard/Reply code} to insert reply code here
% Change address of top
frame if it has different name
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]),
!.
/* CANCEL HANDLER */
handler_cancel(_,e_control(_,_,CTRLWIN,activated),0):-
ezy_object_address(CTRLWIN, CTRL_ADDRESS),
write("Button(",CTRL_ADDRESS,") activated"),nl,
dlg_note("handler_cancel Button Pressed","Button:[TOP_FRAME.buttons.Cancel]"),
ezy_dialog_destroy([]),
!.
/* XTREE EVENT HANDLER */
xtree_ehandler(_,e_control(_,_,CTRLWIN,ACTION),0):-
ezy_object_address(CTRLWIN, CTRL_ADDRESS),
write("Object
(",CTRL_ADDRESS,"),
ACTION =",ACTION),nl,
fail.
xtree_ehandler(WINDOW,e_mousedbl(PNT,CTRL,0),0):-
ezy_xtree_node_selected(WINDOW,NODE),
write(xtree_ehandler," Open/Close ",NODE),nl,
ezy_xtree_node_openclose(WINDOW),
!.
xtree_ehandler(WINDOW,e_menu(MENU_ID,_),0):-
ezy_menu_item(WINDOW,MENU_ID,MENU_TITLE),
write(xtree_ehandler," menu item selected = [",MENU_TITLE,"]"),nl,
!.
xtree_ehandler(WINDOW,e_mousedown(PNT,CTRL,0),0):-
ezy_xtree_node_selected(WINDOW,NODE),
write(xtree_ehandler," selected ",NODE),nl,
!.
goal
prolog_main().
Copyright © 2003 EDMGROUP (Australia)