Other Things Worth Knowing

Visual LANSA Framework

Other Things Worth Knowing

Note that:

  • Clipboard information is normally remembered across executions of a Framework. You can stop this from happening by using Persistent(FALSE) when using the avSaveValue method.
  • You should not put confidential or critical information on the clipboard. 
  • The volume and frequency of update of information on the clipboard will affect the performance of your application.
WithIdn

Information posted to the clipboard is assigned a set of identifiers.

In Windows applications these are the method parameters named WithIdn.

You can have up to 5 of these in Windows applications and 3 in Web browser application. Each one is a maximum of 32 characters long and they can contain concatenated data.

You need to define a protocol for using WithIdn values.

Generally WithID1(*Component) is a good way of making sure that a component's clipboard entries do not interfere with those of another component.

Of course, there are situations where you do want clipboard entries to be shared and sometimes your filters or command handlers are themselves used in multi-instance contexts. Refer to The Virtual Clipboard for details of sharing the clipboard entries.

ToAValue and FromAValue

Many of the examples use the ToAValue and FromAValue parameters for alphanumeric information. There are equivalent ToNValue and FromNValue parameters for working with numeric values.

The ToAValue / FromAValue information can be at most 255 characters long.

The ToNValue / FromNValue information is a 30,9 numeric value, but the maximum precision is normally constrained by the operating system to 15 digits (integer or decimal). 

ReturnCode

Method avRestoreValue has a ReturnCode parameter that can be used to check whether a clipboard entry was found. For example:

Invoke #AvFrameworkManager.avRestoreValue WithID1(*Component) WithID2(NumberofCopies) ToNValue(#NumCopies) ReturnCode(#Io#Sts)

If '#IO$Sts *ne OK'

   Change #NumCopies 42

Endif

 

UseAValueDefault, UseAValueUDefault and UseNValueDefault

Method avRestoreValue has UseAValueDefault, UseAValueUDefault and UseNValueDefault parameters that can be used to specify which default value should be used when a clipboard entry cannot be found.

This means that the previous example could be more easily coded like this:

Invoke #AvFrameworkManager.avRestoreValue WithID1(*Component) WithID2(NumberofCopies) ToNValue(#NumCopies) UseNValueDefault(42)

 

ForLanguage

There is an additional clipboard parameter named ForLanguage that can be used when the thing being remembered is language dependent. Typically this is used like this:

Invoke #AvFrameworkManager.avSaveValue WithID1(*Component) WithID2(#HelloMessage.Name) FromAValue(#HelloMessage) FoLanguage(*Language)

 

This means that the clipboard maintains different #HelloMessage values for different languages.

Instance

There is an additional numeric parameter named Instance which allows you to keep many instances of a value on the clipboard. This effectively allows you to place lists of things onto the clipboard.

For example, imagine you had a list view containing employee numbers (#EmpNo) and salaries (#Salary) in your program.  Then this code:

Change #Instance 0

SelectList #ListView
   Change #Instance '#Instance + 1'
   Invoke #AvFrameworkManager.avSaveValue WithID1(*Component) WithID2(EMPLOYEE_LIST_EMPNO)
                                FromAValue(#Empno) Instance(#Instance)
   Invoke #AvFrameworkManager.avSaveValue WithID1(*Component) WithID2(EMPLOYEE_LIST_SALARY)
                                FromNValue(#Salary) Instance(#Instance)

Endselect

Invoke #AvFrameworkManager.avSaveValue WithID1(*Component) WithID2(EMPLOYEE_LIST_COUNT)
                             FromNValue(#Instance)

 

Creates a list (and count) of employee numbers and salaries on the clipboard