Cut, Copy and Paste with a mouse click – an example in Visual LANSA

Date:3rd August 2007
Product/Release:Visual LANSA
Abstract:An example to allow 'Cut, Copy and Paste' with a mouse click in Visual LANSA
Submitted By:LANSA Technical Support

This is a simple example to show how you can create a form with options for 'Cut', 'Copy' and 'Paste' with a mouse click in Visual LANSA (also suitable for the Visual LANSA Framework - see the Visual LANSA Framework documentation on how to create command handlers or filters with Visual LANSA).

Create a simple form with this code:

* *************************************************************************************************
* This is an example for 'Cut, Copy and Paste' with a mouse click
* *************************************************************************************************

FUNCTION OPTIONS(*DIRECT)
BEGIN_COM ROLE(*EXTENDS #PRIM_FORM) CLIENTHEIGHT(228) CLIENTWIDTH(488) HEIGHT(255) LEFT(123) TOP(203) WIDTH(496)
DEFINE_COM CLASS(#ADDRESS1.Visual) NAME(#ADDRESS1) DISPLAYPOSITION(1) HEIGHT(19) LEFT(40) PARENT(#COM_OWNER) POPUPMENU(#PMNU_1) TABPOSITION(1) TOP(36) USEPICKLIST(False) WIDTH(363)
DEFINE_COM CLASS(#SURNAME.Visual) NAME(#SURNAME) DISPLAYPOSITION(2) HEIGHT(19) LEFT(40) PARENT(#COM_OWNER) POPUPMENU(#PMNU_1) TABPOSITION(2) TOP(56) USEPICKLIST(False) WIDTH(324)
DEFINE_COM CLASS(#EMPNO.Visual) NAME(#EMPNO) DISPLAYPOSITION(3) HEIGHT(19) LEFT(40) PARENT(#COM_OWNER) POPUPMENU(#PMNU_1) TABPOSITION(3) TOP(88) USEPICKLIST(False) WIDTH(209)
DEFINE_COM CLASS(#GIVENAME.Visual) NAME(#GIVENAME) DISPLAYPOSITION(4) HEIGHT(19) LEFT(40) PARENT(#COM_OWNER) POPUPMENU(#PMNU_1) TABPOSITION(4) TOP(109) USEPICKLIST(False) WIDTH(324)
DEFINE_COM CLASS(#PRIM_PMNU) NAME(#PMNU_1) AUTOACTIONS(Cut+Copy+Paste)
DEFINE_COM CLASS(#PRIM_MITM) NAME(#MITM_1) DISPLAYPOSITION(1) PARENT(#PMNU_1) VISIBLE(False)
End_com

Save and compile this form using the IDE editor.

This will create a form like this:

Example of form

You can use a mouse click to activate options for 'Cut', 'Copy' and 'Paste' with this simple code in Visual LANSA.