Reference Contents > Linked Files System > Sample Link Document Viewer
This window is not designed for use directly within Caliach Vision. It is provided as an open source class in OpenVision.lbs from which you can duplicate to form model for developing your own link display windows.
To create your own link viewing window you must develop the window first in OpenVision. To do this:
Toolbar functions can be implemented by creating the following class methods. If the method exists the tool will be enabled.
$SetDoNotScale with a single boolean parameter of pDoNotScale. Typical code would be:
Calculate iDoNotScale as pDoNotScale Do $cinst.$objs.Jpeg.$horzscroll.$assign(iDoNotScale) Do $cinst.$objs.Jpeg.$vertscroll.$assign(iDoNotScale) Do $cinst.$objs.Jpeg.$noscale.$assign(iDoNotScale) Do $cinst.$toolbars.tbLink.$objs.DoNotScale.$checked.$assign(iDoNotScale)
If set, this tool shows the picture at normal size rather than scaled to fit the window size (only available for some link types).
$SaveLinkChanges with no parameters (this is only useful for OLE objects)
Click to save any changes you have made (only available for some link types).
$PrintDocument with no parameters. Typical code would be:
Click to print the document (only available for some link types).
oLink is a non-visual object that contains methods for accessing and manipulating the link file system. To make use of it you must create an instance (or local) variable of type Object and sub-type VISION.oLink. You can then view all methods with parameters and description in the Interface Manager.
Builds a list of LKTFILE base types into pBaseList.
Closes the Link File data file returns kTrue if successful.
pKey must be a character field and is set on the basis of the current main file and record in the CRB. If the main file or CRB contents are not suitable pKey is set blank.
Opens the Confirm Link user dialog. Must have main file and current record set in CRB.
pLkfRow must be a row (or list with a non-zero $line) defined to include LKFFILE. If LKFSEQ is non-zero and has a valid record the record is updated, otherwise a new record is inserted.
Defines the link list variable to be 'LKTFILE', 'LKFFILE', Path, Type. Most methods with a parameter pLinkList use this method to define the list within them. Type: 0 = file not found, 1 = file of path exists or is OLE link, 2 = path is URL.
$FindKeyRecord (pKey, pSeq, pMessage)
Finds the key record associated with pKey = LKFKEY and pSeq = LKFSEQ. For documents (PO and SO), if no record is found the key is automatically translated into the appropriate history key and a log entry made in pMessage. This method is primarily used to identify (and fix) orphaned link file records.
$FindLinkList (pLinkList, pKey)
Defines pLinkList with columns of LKTFILE, LKFFILE, Path and Type. It then populates the list with any links for which the user has access rights with a key of pKey. If pKey is not set, it will be calculated to the current main file and record in the CRB. Returns the number of links found. Links for PUH and SAH files are handled as a special case in that the list includes any link records for the headers (where Line=0) as well, unless pDoNotGetHeader is set kTrue.
$GetLinkPath (pLinkType, pFile, pKey)
Returns the link file path for the pType linked document of the current main file record. If there is more than one found the first entered will be returned. pFile is optional and only populated if not the current main file. pKey is optional if not the current main file record key and should be provided without linkfile prefix (e.g. POLPTNO). LKTFILE and LKFFILE current records are set if path is found otherwise cleared.
Returns kTrue if the link file system is operational, otherwise kFalse.
Scans all links and populates pLinkList with any links where the path does not find a file.
$ListLinksOfType (pLinkList, pType)
Scans all links and populates pLinkList with links of type pType. If pType is not set, all link records are listed.
Scans all links and populates pLinkList with any links where the key is orphaned. This uses the method $FindKeyRecord() - see details. Opens Alert Message window if any automatic repairs are carried out.
$LoadLink (pPath, pType)
A standard method (generally internally called only) to activate a viewing window or object. It assumes the CRB contents of LKTFILE and LKFFILE. pPath and pType are set to their values from pLinkList. This method is mostly used internally. If the LKTDCLA is an object, this method evaluated the program path and runs the method $LaunchProgram (pProgramPath, pFilePath, pType).
$MakePath (pRoot, pTypePath, pFile, pPath)
Computes the file path or URL into pPath from the three path segments pRoot, pTypePath and pFile. These are typically optLinkPathRoot[LKTVOLU], LKTPATH and LKFPATH respectively. Returns 0 for no valid path, 1 for file path where the file exists and 2 for a URL.
$ManageLinks (pFromKey, pToKey, pMode)
This method is used to transfer, copy and delete links when the related data changes from one key source to another. For example from POL to PUH data. pFromKey is the current LKFKEY value, pToKey is the future LKFKEY for transfer or copy to and pMode is 0 = Transfer, 1 = Copy, 2 = Delete. For Transfer and Copy, link records that exist already with the same type and description text are ignored (to avoid duplication).
Opens the Link File data file returns kTrue if successful. If there is no datafile, one is created and LKTFILE populated with the base list of types. Reads user group membership for use in later $FindLinkList() method calls.
$OpenLinkAction (pMainFile, pKeyValue, pCreateLink)
Standard method to trigger a user link action from a window. pMainFile is the link prefix (e.g. 'PTM'), pKeyValue is the data record key (e.g. PTMPTNO) and pCreateLink is set to kTrue if the user is creating a link, otherwise displaying a link.
$PrintLink (pReportClass, pLkfSeq, pPath)
A standard method for running a print link report where pReportClass is the report class name, pLkfSeq is the link record sequence number and pPath is the file path. It prints a single record report. The report class must have a $LoadPath(cPath) class method.
A standard method to display (or choose from a list) a link based on the main file and the current CRB values. See also $OpenLinkAction() which sets up the main file and CRB for you.
$SetFilePath (pRoot, pTypePath, pFilePath, pFullPath)
With pRoot and pTypePath set to typically optLinkPathRoot[LKTVOLU] and LKTPATH, pFilePath is set to the appropriate final path segment of the file with the full pathname of pFullPath.
Non-Visual display link objects can be any object type class. If the method is not explicitly defined in the Link Type data it must have a $LinkProgram method with parameters pProgramFilePath, pFilePath, pType defined respectively as character, character and short integer.
The object class oLinkProgram is available in OpenVision.lbs in open form which can be used as a model for developing your own custom link non-visual classes.
|See also: -|
Compiled in Program Version 3.10. Help data last modified 22 MAY 2008 08:26. Class wLinkSample last modified 10 OCT 2003 12:37:02.
Reference Contents > Linked Files System > Sample Link Document Viewer