Partager via


CEdit::SetTabStops

Call this function to set the tab stops in a multiple-line edit control.

void SetTabStops( ); 
BOOL SetTabStops( 
   const int& cxEachStop  
); 
BOOL SetTabStops( 
   int nTabStops, 
   LPINT rgTabStops  
);

Parameters

  • cxEachStop
    Specifies that tab stops are to be set at every cxEachStop dialog units.

  • nTabStops
    Specifies the number of tab stops contained in rgTabStops. This number must be greater than 1.

  • rgTabStops
    Points to an array of unsigned integers specifying the tab stops in dialog units. A dialog unit is a horizontal or vertical distance. One horizontal dialog unit is equal to one-fourth of the current dialog base width unit, and 1 vertical dialog unit is equal to one-eighth of the current dialog base height unit. The dialog base units are computed based on the height and width of the current system font. The GetDialogBaseUnits Windows function returns the current dialog base units in pixels.

Return Value

Nonzero if the tabs were set; otherwise 0.

Remarks

When text is copied to a multiple-line edit control, any tab character in the text will cause space to be generated up to the next tab stop.

To set tab stops to the default size of 32 dialog units, call the parameterless version of this member function. To set tab stops to a size other than 32, call the version with the cxEachStop parameter. To set tab stops to an array of sizes, use the version with two parameters.

This member function is only processed by multiple-line edit controls.

SetTabStops does not automatically redraw the edit window. If you change the tab stops for text already in the edit control, call CWnd::InvalidateRect to redraw the edit window.

For more information, see EM_SETTABSTOPS and GetDialogBaseUnits in the Windows SDK.

Example

See the example for CEditView::SetTabStops.

Requirements

Header: afxwin.h

See Also

Reference

CEdit Class

Hierarchy Chart

CWnd::InvalidateRect