Code Examples‎ > ‎

Richedit - setting tabs

posted Jan 15, 2011, 6:04 PM by Sevag Krikorian
The following code sniplet will set the tab stops of a Richedit control (Windows) in average character widths of the currently selected font.

//.. set your font

// get base dialog units
w.GetDialogBaseUnits();

// dereference the low order word
movzx( ax, eax );

// multiply result with the number of tab in characters that you want.
// 6 in this case
mov( 6, ecx );
mul( ecx );

// divide the result by 2
shr( 1, eax );

// store it in a variable and set the tab stops
mov( eax, tabs );
w.SendMessage(hred, w.EM_SETTABSTOPS, 1, &tabs );

//.. redraw the window

Comments