TOutLook
Source: source/classes/outlook.prg
Inherits from: TControl
TOutLook implements an Outlook-style navigation bar with collapsible groups containing icon-and-text navigation items. It is commonly used as a sidebar panel in MDI or SDI applications to organize navigation destinations into logical categories, similar to Microsoft Outlook's folder pane.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
aGroup | Array | Array of group objects containing items |
nActual | Numeric | Index of the currently selected item |
Methods
| Method | Description |
|---|---|
New( nTop, nLeft, nW, nH, nClrF, nClrB, nStyle, oFont, lPixel, oWnd ) | Create a new TOutLook control |
AddGroup( cPrompt ) | Add a new collapsible group with the given caption |
AddItem( cPrompt, cBmp, cRes, bAction, nGroup ) | Add an item to the specified group |
Set( nGroup ) | Expand a specific group by its index |
DeleteItem( oItem ) | Remove an item from its group |
MoveToGroup( xItem, nGroup ) | Move an item (by index or object reference) to a different group |
SaveOrder() | Return the current group/item order as a serialized string |
RestoreOrder( cOrder ) | Restore a previously saved group/item order |
Example: Two Groups with Items
#include "FiveWin.ch"
function Main()
local oWnd, oOutLook
DEFINE WINDOW oWnd TITLE "Outlook Bar" SIZE 300, 500
@ 10, 10 OUTLOOK oOutLook ;
SIZE 280, 460 OF oWnd
oOutLook:AddGroup( "Mail" )
oOutLook:AddItem( "Inbox", "mail1.ico", , {|| MsgInfo( "Inbox" ) }, 1 )
oOutLook:AddItem( "Sent", "mail2.ico", , {|| MsgInfo( "Sent" ) }, 1 )
oOutLook:AddItem( "Drafts", "mail3.ico", , {|| MsgInfo( "Drafts" ) }, 1 )
oOutLook:AddGroup( "Calendar" )
oOutLook:AddItem( "Today", "cal1.ico", , {|| MsgInfo( "Today" ) }, 2 )
oOutLook:AddItem( "Week", "cal2.ico", , {|| MsgInfo( "Week" ) }, 2 )
oOutLook:AddItem( "Month", "cal3.ico", , {|| MsgInfo( "Month" ) }, 2 )
oOutLook:Set( 1 )
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- Groups are displayed as collapsible headers. Clicking a group header expands it and collapses the previously expanded group.
- Items display an icon and a caption. The
cBmpparameter accepts a bitmap file path, resource name, or icon. - The
bActioncode block inAddItem()is executed when the user clicks the item. - Use
SaveOrder()to persist the user's custom group/item arrangement (e.g. in the registry or an INI file) andRestoreOrder()to reload it on the next session. - The control automatically handles vertical scrolling when groups and items exceed the visible area.