TVistaMenu

Source: source/classes/vistamnu.prg

Inherits from: TControl

TVistaMenu provides a modern vertical menu panel with Vista-style visual rendering. Each item displays text and an optional icon, with configurable highlight colors for the hovered selection. The control is suitable for navigation panels and sidebar menus.

Key DATA Members

DATATypeDescription
aItemsArrayArray of menu item definitions
oOverNumericIndex of the item currently under the mouse
nOptionFocusNumericIndex of the currently focused item (keyboard navigation)
nClrPaneOverNumericBackground color of the hovered item
nClrTextOverNumericText color of the hovered item
nClrBorderOverNumericBorder color of the hovered item

Methods

MethodDescription
New( nRow, nCol, nW, nH, oWnd, oFont, oFont2 )Create a new vista menu control
Redefine( nId, oWnd, oFont, oFont2 )Redefine from a dialog resource
AddItem( cText, cImage, bAction )Add a menu item with text, image path and action
InsertItem( n, cText, cImage, bAction )Insert a menu item at the specified position
DelItem( n )Delete a menu item at the given position
GoUp()Move keyboard focus to the previous item
GoDown()Move keyboard focus to the next item

Example: Vertical Menu with Icons

#include "FiveWin.ch"

function Main()

   local oWnd, oVMenu

   DEFINE WINDOW oWnd TITLE "TVistaMenu Demo" SIZE 400, 400

   @ 10, 10 VISTAMENU oVMenu ;
      OF oWnd ;
      SIZE 180, 300 ;
      FONT oWnd:oFont

   oVMenu:AddItem( "&Dashboard",   "images/dash.bmp",  { || MsgInfo( "Dashboard" ) } )
   oVMenu:AddItem( "&Customers",  "images/cust.bmp",  { || MsgInfo( "Customers" ) } )
   oVMenu:AddItem( "&Orders",     "images/ord.bmp",   { || MsgInfo( "Orders" ) } )
   oVMenu:AddItem( "&Reports",    "images/rpt.bmp",   { || MsgInfo( "Reports" ) } )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also