Creating a Desktop Menu Using Large Icons in List View

Visual LANSA

Creating a Desktop Menu Using Large Icons in List View

In this example a list view in LargeIcon view acts as a simple desktop style menu for "Accounts", "Orders" and "Customers".   Double-clicking on the icon invokes the option. The ViewStyle property of the list view is set to Icon.

To see how the example works,  copy this code and paste it to a form component:

FUNCTION options(*DIRECT)

BEGIN_COM role(*EXTENDS #PRIM_FORM) HEIGHT(337) LEFT(381) TOP(135) WIDTH(325)
DEFINE_COM class(#PRIM_LTVW) name(#LTVW_1) DISPLAYPOSITION(1) FULLROWSELECT(True) HEIGHT(285) LEFT(8) PARENT(#COM_OWNER) SELECTIONSTYLE(Single) TABPOSITION(1) TOP(8) VIEWSTYLE(Icon) WIDTH(297)
DEFINE_COM class(#PRIM_LVCL) name(#LVCL_1) DISPLAYPOSITION(1) PARENT(#LTVW_1) SOURCE(#STD_TEXTS) WIDTH(50) WIDTHTYPE(Characters)
EVTROUTINE handling(#com_owner.Initialize)
INVOKE method(#com_owner.uLargeIcon) U_MENU(Accounts) U_ICON(#VI_FOLDR1)
INVOKE method(#com_owner.uLargeIcon) U_MENU(Orders) U_ICON(#VI_FOLDR2)
INVOKE method(#com_owner.uLargeIcon) U_MENU(Customers) U_ICON(#VI_FOLDR3)
ENDROUTINE
MTHROUTINE name(uLargeIcon)
DEFINE_MAP for(*INPUT) class(#std_TEXTS) name(#u_Menu)
DEFINE_MAP for(*INPUT) class(#PRIM_Icon) name(#u_Icon) pass(*by_reference)
CHANGE field(#STD_TEXTS) to('#U_MENU.VALUE')
ADD_ENTRY to_list(#LTVW_1)
SET com(#LTVW_1.CurrentItem) IMAGE(#u_Icon)
ENDROUTINE

EVTROUTINE handling(#ltvw_1.doubleclick) options(*NOCLEARMESSAGES *NOCLEARERRORS)
USE builtin(MESSAGE_BOX_SHOW) with_args(OK OK INFORMATION 'You have selected:' #STD_TEXTS)
ENDROUTINE
END_COM

 

Ý 6.15.8 Working with Items in Lists