TIconGroup / TIconGet

Sources: source/classes/igroup.prg, source/classes/iget.prg

TIconGroup FROM TControl | TIconGet FROM TMultiGet

TIconGroup displays a grid of icons with text prompts. Users can navigate with keyboard arrows, click to select, and double-click to execute actions. TIconGet is an edit control used internally by TIconGroup for inline prompt editing.

Key DATA Members (TIconGroup)

DATATypeDescription
aIconsArrayArray of icon handles (hIcon)
aPromptsArrayArray of text labels below each icon
aActionsArrayArray of code blocks executed on double-click
aCoorsArrayArray of coordinate arrays (icon + text bounding boxes)
aOrderArrayVisual order of icons (indices into aIcons)
nFocusedNumericIndex of the currently focused icon
lEditLogical.T. when editing a prompt inline
lAutoEditLogical.T. enables inline editing on click; F2 always triggers edit

Methods (TIconGroup)

MethodDescription
New( nTop, nLeft, nW, nH, aIcons, aPrompts, aActions, oWnd )Create an icon group control
ReDefine( nId, aIcons, aPrompts, aActions, oWnd )Redefine from a dialog resource
Add( hIcon, cPrompt, bAction )Add an icon with label and action to the group
Modify( hIcon, cPrompt, bAction, nAt )Modify icon, prompt or action at position
Del( nAt )Delete icon, prompt and action at position
Adjust()Recalculate icon positions in grid layout
Arrange()Reset scroll positions and re-layout all icons

Commands

@ nRow, nCol ICONGROUP ITEMS aIcons, aPrompts, aActions ;
   SIZE nW, nH OF oWnd

Example: Icon Grid with Click Actions

#include "FiveWin.ch"

function Main()

   local oWnd, oIconGrp
   local aIcons   := {}
   local aPrompts := {}
   local aActions := {}

   DEFINE WINDOW oWnd TITLE "Icon Group Demo" SIZE 400, 300

   AAdd( aIcons,   "folder.ico" )
   AAdd( aPrompts, "Open" )
   AAdd( aActions, {|| MsgInfo( "Open clicked" ) } )

   AAdd( aIcons,   "help.ico" )
   AAdd( aPrompts, "Help" )
   AAdd( aActions, {|| MsgInfo( "Help clicked" ) } )

   @ 10, 10 ICONGROUP ITEMS aIcons, aPrompts, aActions ;
      SIZE 300, 200 OF oWnd

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also