Copyright (1997-2013) EDMGROUP Pty Ltd - EZY Prolog Reference

Samples\ezy_xtree.ezy

main page

XTree functional calls

 

 

The Xtree control sample consists of 2 components inside ezy_xtree.ezy file:

  • GUI declarations

  • EZY Prolog programs.

EZY 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:

  • loads EZY form with Xtree control

  • initializes GUI elements

 

 

 

predicates

    initialize_gui: EZY_INITIALIZE_GUI
    % EVENT HANDLERS CODE
    cl_frame_handler: EHANDLER
    handler_ok: EHANDLER
    handler_cancel: EHANDLER
    xtree_handler: EHANDLER
clauses

% START OF GUI INITIALIZE

% EZY PROLOG PASSES CONTROL TO THIS CLAUSE WHEN FORM LOADED

initialize_gui(WINDOW):-
    write("GUI initialization started"),nl,
% END OF GUI INITIALIZE

    write("GUI Initialization completed"),nl,
    !.

initialize_gui(_):-
    write("GUI initialization failed"),nl,
    !.

% Frame Default Event Handler

cl_frame_handler(_,_,_):-
    fail.
% OK EVENT HANDLER

handler_ok(_,e_control(_,_,CTRLWIN,activated),0):-!,
    ezy_object_address(CTRLWINCTRL_ADDRESS),
    write("Button(",CTRL_ADDRESS,") activated"),nl,
    dlg_note("handler_ok Button Pressed","Button:[TOP_FRAME.buttons.Ok]"),
    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 EVENT HANDLER

handler_cancel(_,e_control(_,_,CTRLWIN,activated),0):-!,
    ezy_dialog_destroy([]).


% XTREE EVENT HANDLER

xtree_handler(WINDOW,e_mousedbl(PNT,CTRL,0),0):-!,
    ezy_xtree_node_selected(WINDOW,NODE),
    write(xtree_handler," Xtree Open/Close PNT=",PNT,", NODE=",NODE),nl,
    ezy_xtree_node_openclose(WINDOW).

% [MENU Start]

xtree_handler(WINDOW,e_menu(MENU_TAG,ShiftCtlAlt),0):-!,
    ezy_menu_item(WINDOW,MENU_TAG,MENU_TITLE),
    write("MENU_TITLE =",MENU_TITLE).
xtree_handler(WINDOW,e_mousedown(PNT,CTRL,0),0):-!,
    ezy_xtree_node_selected(WINDOW,NODE),
    write(xtree_handler," Xtree selected PNT=",PNT,", NODE=",NODE),nl.

goal

    true.

Copyright 2003 EDMGROUP (Australia)