VP Studio Shell - compare default code

back to main page

 

Visual Prolog development environment provides basic code frame for the window and programmer should define how custom control will be drawn by Windows.

 

Visual Prolog Default Code

%BEGIN Test Window, e_Create

win_test_window_eh(_Win,e_Create(_),0):-!,

 

%BEGIN Test Window, InitControls,

win_CreateDynControl([customctl(wdef(wc_Custom,rct(4,4,233,156),

"Tree View",u_Pixels),"class_catalog_view",

idc_tree_view,[wsf_Group,wsf_TabStop])],_Win),

%END Test Window, InitControls

%BEGIN Test Window, ToolbarCreate,

%END Test Window, ToolbarCreate

!.

%END Test Window, e_Create

Basically VDE provides set of constants and necessary calls for window e_create event.

 

After that programmer should code necessary calls to register class handler for custom control and handle standard events, which control class behaviour (such as e_create, e_size and e_update).

 

 

Your resulting application will work but without any functionality associated with custom control.

 

This is the most time consuming part in designing and programming GUI using Visual Prolog.

 

If you are experienced user - you probably have code samples for each custom control (majority of them you can find in VIP samples).

 

But if you are unexperienced - you need to learn by going through code samples how to program controls.

You will have different results
with VP Studio Shell

Yes. VP Studio shell will generate all necessary codes for selected custom control and you only need to compile your project and run it.

For example, the same Test Window will have the following default code:

 

%BEGIN Colred Editor, e_Create

win_colred_editor_eh(_Win,e_Create(_),0):-!,

SysObject = system_object::new(_Win),

SysObject:system_color("normal_background",color_blue),

%BEGIN Colred Editor, InitControls, 10:54:36-5.5.2002, Code automatically updated!

FONT_idc_custom1_str = "$[E8,FF,FF,FF,00,00,00,00,00,00,00,00,...,00,A4,F1,12,00]",

term_str(FONT,FONT_idc_custom1,FONT_idc_custom1_str),

VPS_CONTROL_idc_custom1 =

vps_caption(

vp_label("LABEL WITH BACKGROUND AND FOREGROUND COLOR",65535)),

_Win_idc_custom1 =

system_support::create_class(_Win,

"cl_label",

vps_ctl(VPS_CONTROL_idc_custom1,12615808," No alignment",FONT_idc_custom1),

rct(5,40,525,80),idc_custom1,[wsf_Group,wsf_TabStop]),

FONT_idc_custom_str = "$[E5,FF,FF,FF,00,00,00,..E4,EF,12,00]",

term_str(FONT,FONT_idc_custom,FONT_idc_custom_str),

VPS_CONTROL_idc_custom =

vps_editor(vps_ehandler(

vps_hand(my_editor_callback),"my_editor_callback"),

vps_menu(id_editor_popup_menu,"Editor Popup Menu"),

s("EDITOR WITH USER DEFINED MENU AND CALLBACK")

),

_Win_idc_custom =

system_support::create_class(_Win,"cl_editor_colored",

vps_ctl(VPS_CONTROL_idc_custom,255,"Align to parent RightBottom",FONT_idc_custom),

rct(5,120,525,325),idc_custom,[wsf_Group,wsf_TabStop]),

%END Colred Editor, InitControls

%BEGIN Colred Editor, ToolbarCreate, 10:54:36-5.5.2002, Code automatically updated!

tb_project_toolbar_Create(_Win),

%END Colred Editor, ToolbarCreate

href_support::fit_to_parent(_Win),

!.

%END Colred Editor, e_Create

 

VP Studio Shell generates necessary code wrapper for created GUI element and makes it ready for programming.

 

Click here to see AUTOMATIC CONTROL ALIGNMENT FEATURE

 

 

See compiled application...

 

 


 

Copyright 1998-2002 EDMGROUP (Australia)

 

Last Updated: May 13, 2002