|
Button with Picture |
Button with picture:
This is an enhanced version of the standard Visual Prolog custom control.
To include Button with picture - open your project.inc file with VP Studio Setup utility and checkout "Button with bitmap" option.
Please save your changes and open Visual Prolog project.
(click here to download VIP52 project)
Create custom control with the name "bmpctrl":
Place the following code inside Window e_create() event. This will create necessary links between standard objects and user-definable event handler.
%BEGIN Button, e_Create
SysObject
= system_object::new(_Win),
PICTURE_BUTTON_HANDLER_REF
= cast(LONG,picture_button_handler),
SysObject:save_object_ref(bmp_class_tagname,PICTURE_BUTTON_HANDLER_REF),
%BEGIN
Button, InitControls, 11:34:34-22.5.2000, Code automatically updated!
win_CreateDynControl([customctl(wdef(wc_Custom,rct(13,9,231,169),"Custom",u_Pixels),"bmpctrl",bitmap_button,[wsf_Group,wsf_TabStop])],_Win),
%END Button, InitControls
....
%END Button, e_Create
Place the following declarations inside object event handler
picture_button_handler(BMPWin,e_create(_DATA),0):-
syspath(ExeStartupPath,_),
format(BMPFILE,"%sopen.bmp",ExeStartupPath),
button_bitmap::set_file(BMPWin,BMPFILE,b_true),
button_bitmap::drawbutton(BMPWin,b_true),
!.
picture_button_handler(_Win,e_update(_),0):-
write("Update
Button\n"),
button_bitmap::drawbutton(_Win,b_true),!.
Copyright 1998-2000 EDMGROUP (Australia)
Last Updated: March 20, 2002