From: David W on
Hello,

I'm experimenting with a CRichEditCtrl and just need some help to get
started. I'm trying to set tabstop positions so I can display a read-only
multi-line table with aligned columns of text. I tried the code below, but
it has no effect, wherever I put the tabstop.

// m_textReport is a CRichEditCtrl
m_textReport.SetWindowText("Abc\tXyz\n");
m_textReport.SetSel(0, m_textReport.GetTextLength()-1);
PARAFORMAT pfmt;
pfmt.cbSize = sizeof(pfmt);
pfmt.dwMask = 0;
pfmt.wReserved = 0;
pfmt.dxStartIndent = 0;
pfmt.dxRightIndent = 0;
pfmt.dxOffset = 0;
pfmt.wAlignment = 0;
pfmt.cTabCount = 1;
pfmt.rgxTabs[0] = 10;
VERIFY(m_textReport.SetParaFormat(pfmt));

The control is shown and the text is there with "Xyz" at the default tab
position, but I can't move it. How can I get this working? I'm using Windows
XP SP1a and VC++ 6.0 SP6.

David


From: AliR on
Try this

PARAFORMAT pfmt;
memset(&pfmt,0,sizeof(pfmt);
pfmt.cbSize = sizeof(pfmt);
pfmt.dwMask = PFM_TABSTOPS;
pfmt.cTabCount = 1;
pfmt.rgxTabs[0] = 100;
m_textReport.SetParaFormat(pfmt);

AliR.


"David W" <no(a)email.provided> wrote in message
news:lVcFg.8058$b6.133041(a)nasal.pacific.net.au...
> Hello,
>
> I'm experimenting with a CRichEditCtrl and just need some help to get
> started. I'm trying to set tabstop positions so I can display a read-only
> multi-line table with aligned columns of text. I tried the code below, but
> it has no effect, wherever I put the tabstop.
>
> // m_textReport is a CRichEditCtrl
> m_textReport.SetWindowText("Abc\tXyz\n");
> m_textReport.SetSel(0, m_textReport.GetTextLength()-1);
> PARAFORMAT pfmt;
> pfmt.cbSize = sizeof(pfmt);
> pfmt.dwMask = 0;
> pfmt.wReserved = 0;
> pfmt.dxStartIndent = 0;
> pfmt.dxRightIndent = 0;
> pfmt.dxOffset = 0;
> pfmt.wAlignment = 0;
> pfmt.cTabCount = 1;
> pfmt.rgxTabs[0] = 10;
> VERIFY(m_textReport.SetParaFormat(pfmt));
>
> The control is shown and the text is there with "Xyz" at the default tab
> position, but I can't move it. How can I get this working? I'm using
Windows
> XP SP1a and VC++ 6.0 SP6.
>
> David
>
>


From: David W on
"AliR" <AliR(a)online.nospam> wrote in message
news:44e5d81a$0$15186$a8266bb1(a)reader.corenews.com...
> Try this
>
> PARAFORMAT pfmt;
> memset(&pfmt,0,sizeof(pfmt);
> pfmt.cbSize = sizeof(pfmt);
> pfmt.dwMask = PFM_TABSTOPS;
> pfmt.cTabCount = 1;
> pfmt.rgxTabs[0] = 100;
> m_textReport.SetParaFormat(pfmt);

Thanks. I guess I should have read a bit more. It also didn't work because
my tabstop was too short. Even 1000 isn't very far.

David