Highlighting
Highlighting
With highlighting, M!Table provides an easy way to highlight certain table items ( e.g. a cell or a column header ) with another color ( background and/or text color ), font enhancement or image.
Highlightings are neither printed nor exported.
A defined highlighting color ( e.g. background color ) supersedes the appropriate selection color.
In the first step, the highlighting settings for the different item types/parts must be defined with MTblDefineHighlighting.
Then, to set or remove the highlighted state for an item, call MTblSetHighlighted.
Along with the notification messages MTM_MouseEnterItem and MTM_MouseLeaveItem, it's also possible to easily generate hot tracking effects ( see hints and tips below ).
Functions
MTblDefineHighlighting
MTblQueryHighlighting
MTblGetEffHighlighting
MTblSetHighlighted
MTblIsHighlighted
Classes
fcMTblHiLiDef
Supported item types/parts and highlighting settings
Item type |
Item part |
Affected items |
Supported highlighting settings of fcMTblHiLiDef |
||||
BackColor |
TextColor |
FontEnh |
Image |
ImageExp |
|||
MTBL_ITEM_CELL |
MTBL_PART_UNDEF |
Cells |
Yes |
Yes |
Yes |
Yes |
Yes |
MTBL_ITEM_CELL |
MTBL_PART_NODE |
Tree nodes of cells |
Yes |
--- |
--- |
Yes |
Yes |
MTBL_ITEM_COLUMN |
MTBL_PART_UNDEF |
Whole columns |
Yes |
Yes |
--- |
--- |
--- |
MTBL_ITEM_COLHDR |
MTBL_PART_UNDEF |
Column headers |
Yes |
Yes |
Yes |
Yes |
--- |
MTBL_ITEM_COLHDRGRP |
MTBL_PART_UNDEF |
Column header groups |
Yes |
Yes |
Yes |
Yes |
--- |
MTBL_ITEM_ROW |
MTBL_PART_UNDEF |
Whole rows |
Yes |
Yes |
--- |
--- |
--- |
MTBL_ITEM_ROWHDR |
MTBL_PART_UNDEF |
Row headers |
Yes |
Yes |
Yes |
Yes |
Yes |
MTBL_ITEM_ROWHDR |
MTBL_PART_NODE |
Tree nodes of row headers |
Yes |
--- |
--- |
Yes |
Yes |
MTBL_ITEM_CORNER |
MTBL_PART_UNDEF |
Corner |
Yes |
Yes |
Yes |
Yes |
--- |
Hints and tips
Generate hot tracking effects
Let's say you want to highlight the row beneath the mouse pointer with another background color.
This can be achieved as follows:
- Enable extended messages with MTblEnableExtMsgs ( so that the messages MTM_MouseEnterItem and MTM_MouseLeaveItem are sent )
and define ( with MTblDefineHighlighting ) the background color that shall be used to highlight rows :
...
Window Variables:
fcMTblHiLiDef: HiLiDef
fcMTblItem: oItem
...
On SAM_Create
...
! Enable extended messages
Call MTblEnableExtMsgs( hWndForm, TRUE )
! Set the highlight background color for rows to a light orange
Call HiLiDef.Init( )
HiLiDef.BackColor = SalColorFromRGB( 255, 192, 128 )
Call MTblDefineHighlighting( hWndForm, MTBL_ITEM_ROW, MTBL_PART_UNDEF, HiLiDef, 0 )
... - On MTM_MouseEnterItem, check if the mouse pointer has entered a row. If yes, highlight the entered row:
On MTM_MouseEnterItem
! Determine if a row has been entered
Call MTblGetItem( hWndForm, lParam, oItem )
If oItem.Type = MTBL_ITEM_ROW
! Highlight the row
Call MTblSetHighlighted( oItem, TRUE ) - On MTM_MouseLeaveItem, check if the mouse pointer has left a row. If yes, remove highlighting from that row:
On MTM_MouseLeaveItem
! Determine if a row has been left
Call MTblGetItem( hWndForm, lParam, oItem )
If oItem.Type = MTBL_ITEM_ROW
! Remove the highlighting
Call MTblSetHighlighted( oItem, FALSE )
Created with the Personal Edition of HelpNDoc: Free Web Help generator