Directory Browser |
What is directory browser?
Grid Object is a Visual Prolog custom control for file selection implemented as Visual Prolog Class.
To include Grid Object - open your project.inc file with VP Studio Setup utility and checkout option . Please save your changes and open Visual Prolog project.
Object usage: - create custom
control with custom class "directory_browser".
Download Source code for Directory Browser (VIP 5.2 project - 68KB)
Custom control event handler will retrieve reference to callback function
from the system object of the parent window.
%BEGIN win_directory_browser_eh, e_Create
win_directory_browser_eh(_Win,e_Create(_),0):-!,
SysObject
= system_object::new(_Win),
BrowserRef
= cast(long, directory_callback),
SysObject:save_object_ref("browser_callback",BrowserRef),
.........<call for custom control creation>........
% setup browser object properties
CtrlWin =
win_GetCtlHandle(_Win, browser_id),
get_browser_object(CtrlWin,DirObject),
FileTypeList = [
file_type("All Files","*.*"),
file_type("Prolog Source","*.pro"),
file_type("Internet HTM","*.htm*")
],
DirObject:set_file_types(FileTypeList),
!.
If you would like to use
directory_browser object
inside a dialog - you need to change a call to dialog creation predicate:
1) Parent window
should have a system object created and should have reference to the browser_callback predicated stored
(see explanations above)
2). You need to pass reference to the parent window system object via ApplicationCreationData.
dlg_file_open_Create(Parent):-
DialogCreationData
= win_GetData(Parent),
dialog_CreateModal(Parent,dlg_file_open_ResID,"",
[],
dlg_file_open_eh,
DialogCreationData,VALLIST,ANSWER),
......
%BEGIN File Open, e_Create
dlg_file_open_eh(_Win,e_Create(_CreationData),0):-!,
CtrlWin =
win_GetCtlHandle(_Win, browser_id),
get_browser_object(CtrlWin,DirObject),
FileTypeList = [
file_type("All Files","*.*"),
file_type("Prolog Source","*.pro"),
file_type("Internet HTM","*.htm*")
],
DirObject:set_file_types(FileTypeList),!.
%END File Open, e_Create
Use this code to retrieve direcotry_browser object and access it's properties and methods.
...CtrlWin = win_GetCtlHandle(_Win,
browser_id),
get_browser_object(CtrlWin,DirObject),
DirObject:<object_method_call>
Copyright 1998-2000 EDMGROUP (Australia)
Last Updated: 03/20/02