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

back to main page

Download EZY Prolog

Visual Prolog DLL event handler test

Group

ezy_control_frame

ezy_dll

 

Description

This sample demonstrates how to define external event handler and process events inside Visual Prolog DLL.

DLL sources in -  Visual Prolog 5.2 sample DLL

User can use full set of Visual Prolog predicates inside DLL event handler.

Please start EZY Prolog, load and run ezy_frame_ehandler_test.pro file for test.

 

test__button_ehandler(_,e_control(_,_,CTRLWIN,ACTION)):-

ezy_object_address(CTRLWIN,CTRL_ADDRESS),

CTRL_ADDRESS=["test_frame","Default"],

write("Button(",CTRL_ADDRESS,") Action:",ACTION),nl,

dlg_note("Button Pressed","Button:[test_frame.Default]"),

ezy_get_parent(CTRLWIN,"test_frame",PARENTWIN),

ADDRESS=["test_frame","TEST"],

ezy_get_object(PARENTWIN,ADDRESS,TEST_WINDOW),

ezy_frame_handler(TEST_WINDOW,vps_ehandler_default),

!.

 

test__button_ehandler(_,e_control(_,_,CTRLWIN,ACTION)):-

ezy_object_address(CTRLWIN,CTRL_ADDRESS),

CTRL_ADDRESS=["test_frame","External"],

write("Button(",CTRL_ADDRESS,") Action:",ACTION),

nl,

dlg_note("Button Pressed","Button:[test_frame.External]"),

ezy_get_parent(CTRLWIN,"test_frame",PARENTWIN),

ADDRESS=["test_frame","TEST"],

ezy_get_object(PARENTWIN,ADDRESS,TEST_WINDOW),

ezy_frame_handler(TEST_WINDOW,

vps_external_handler("ezy_dll_test","ezy_draw")),

!.

 

 

/* Visual Prolog DLL event handler: Visual Prolog 5.2 sample DLL  */

ezy_draw(_Win,EVENT,1):-

RCT = win_GetClientRect( _Win ),

trap(win_Clear(_Win, RCT, color_red),_,fail),

term_str(EVENT,EVENT,EVENT_STR),

format(MSG,

"EZY Prolog DLL subsystem test\nEZY Event handler\nProcessing event in:\nezy_dll_test(ezy_draw)\nEvent:%",

EVENT_STR),

trap(draw_TextInRect(_Win,RCT, MSG, -1,[dtext_Expandtabs,dtext_Wordbreak]),_,fail),

!.

ezy_draw(_,_,1):-!.

 

Copyright 1997-2013 EDMGROUP (Australia)