1. Home
  2. Knowledge Base
  3. Linked Files System
  4. Linked Files System: Sample Link Document Viewer

Linked Files System: Sample Link Document Viewer

Link window design

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.

Customisation

To create your own link viewing window you must develop the window first in OpenVision. To do this:

  1. Launch Omnis Studio design edition and open your Vision.lbs. Log on in the normal way.
  2. Operate File — Advanced — Custom Features Utility.
  3. OpenVision.lbs will open (which you may have re-named.
  4. Double-click on OpenVision in the library browser to view the classes.
  5. Locate wLinkSample, select it, right-click and operate Duplicate.
  6. A copy of wLinkSample will be created and you can rename it using your adopted naming convention.
  7. Double-click to open the window in design mode. There are no objects on the window but the inherited toolbar is visible.
  8. You now need to locate the ActiveX (or other external component) you want to use on your custom window.
  9. Switch to the Component Store and if there is no ActiveX tool, right click and select External Components.
  10. Expand the ActiveX branch of the tree list and select the component you are to use.
  11. You will then need to set the Pre-Load Status to Opening ‘OPENVISION’ (this will become irrelevant in Vision but it is necessary to have the ActiveX available in OpenVision for you to add it to a window).
  12. Confirm with an Ok and the External Components window will close.
  13. Now click on the ActiveX tool on the Component Store toolbar and your component will show below.
  14. Drag the component icon onto the custom window and resize it to fill the available space.
  15. Set the following properties: $name = <sensible name>, $edgefloat = kEFrightBottom and $effect = kBorderChisel.
  16. You now need to explore the properties and methods of the component in the Property Manager so that you can establish a way of loading the property with the external file for display. This will either be a property such as $filename or a method such as $loadpath(cPath). Once you have established how the component works you can then complete the window class methods.
  17. Right-click on the window and choose Class Methods to open the method editor. Select the $LoadFile method.
  18. Typically a single Do command is needed such as: Do $cinst.$objs.ObjectName.$filename.$assign(lPath) or Do $cinst.$objs.ObjectName.$loadpath(lPath)
  19. Such an example is commented in the code. It is not recommended that you alter other code.
  20. Close the design window and copy it to Vision for testing.

$LoadFile method editting

Toolbar functions can be implemented by creating the following class methods. If the method exists the tool will be enabled.

Tool

Method

Function

No scale No scale

$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).

Save Save

$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).

Print Print

$PrintDocument with no parameters. Typical code would be:

Do $cinst.$objs.Rtf.$printdocument()

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.

Method

Description

$BaseTypesList (pBaseList)

Builds a list of LKTFILE base types into pBaseList.

$CloseDataFile ()

Closes the Link File data file returns kTrue if successful.

$CreateKeyFromCRB (pKey)

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.

$CreateLinkDialog ()

Opens the Confirm Link user dialog. Must have main file and current record set in CRB.

$CreateSaveLink (pLkfRow)

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.

$DefineLinkList (pLinkList)

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.

$LinkIsActive ()

Returns kTrue if the link file system is operational, otherwise kFalse.

$ListBrokenLinks (pLinkList)

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.

$ListOrphanLinks (pLinkList)

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).

$OpenDataFile ()

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.

$SelectLink ()

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 Objects

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 5.10. Help data last modified 4 Jun 2012 04:48:00.00. Class wLinkSample last modified 18 Feb 2015 01:54:43.

Was this article helpful?

Related Articles

Get started.

Try our state-of-the-art ERP Manufacturing Software today.