Automatic edit sizing and positioning
Automatic edit sizing and positioning
With M!Table it's possible to automatically adapt the size and/or position of an edit control.
Clipping the noneditable area
To achieve that the noneditable area of a cell remains visible when a cell gets the input focus, you may set one of the following flags:
MTBL_CELL_FLAG_CLIP_NONEDIT
MTBL_COL_FLAG_CLIP_NONEDIT
MTBL_ROW_CLIP_NONEDIT
Sizing the edit control automatically
To achive that the size of an edit control is automatically adpated, you may set one of the following flags:
MTBL_CELL_FLAG_AUTOSIZE_EDIT
MTBL_COL_FLAG_AUTOSIZE_EDIT
MTBL_ROW_AUTOSIZE_EDIT
If a cell is multiline, only the height is adapted, otherwise only the width.
The size of a cell's edit control is adpated:
- when a cell gets the input focus
- when the user changes the content of the edit control
The width isn't adapted:
- if the cell has a right aligned button ( M!Table button and/or drop down button )
- if one of the *CLIP_NONEDIT flags is set and the cell has a noneditable area to the right of the cell text, e.g. an image
Hints and tips
Adapting the row height after the user edited a cell or while the user is editing a cell
It's quite easy to adapt the row height after the user edited a cell ( like in M$ Excel ) or even while the user is editing the cell.
First of all, you should activate variable row height by setting the table flag MTBL_FLAG_VARIABLE_ROW_HEIGHT.
To adapt the row height of a multiline cell after the user edited a cell, simply call MTblAutoSizeRows on SAM_Validate of the appropriate column, e.g.:
On SAM_Validate
If MTblQueryFlags( MTBL_FLAG_VARIABLE_ROW_HEIGHT ) And SalTblQueryColumnFlags( hWndItem, COL_MultilineCell )
Call MTblAutoSizeRows( hWndForm, lParam, MTASR_CONTEXTROW_ONLY )
Return VALIDATE_OkClearFlag
To adapt the row height of a multiline cell while the user is editing a cell, simply call MTblAutoSizeRows on SAM_AnyEdit of the appropriate column, e.g.:
On SAM_AnyEdit
If MTblQueryFlags( MTBL_FLAG_VARIABLE_ROW_HEIGHT ) And SalTblQueryColumnFlags( hWndItem, COL_MultilineCell )
Call MTblAutoSizeRows( hWndForm, lParam, MTASR_CONTEXTROW_ONLY )
Created with the Personal Edition of HelpNDoc: What is a Help Authoring tool?