15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Tabs in a CRichEditCtr?

Jan Melander -- jan.melander@got.wmdata.se
Thursday, February 27, 1997

Environment : NT 4.0, MSVC++ 4.1

Help!

I have used a CRichEditCtrl to create a text editor view and I have tried
to activate tab stops in the control, as default the tab key does nothing.

I have used GetParaFormat to get the PARAFORMAT struct then I put some
tab position in the rgxTabs array, the no. of tabs in cTabCount and add
PFM_TABSTOPS to the dwMask.

I then read the text into the ctrl, select all the text with SetSel(0,
-1), and tries to set the new format with SetParaFormat.

But the tab key still does nothing in the Ctrl...

I have noticed that as default values I get 1 in the cTabCount and 720 in
the first index of the rgxTabs array, what's up?

I got a tip from David Elliot that the problem why the tab key don't work 
might not be connected with the paragraph format, any one got a clue here?

Any help are appreciated!

Cheers,


---------------------------------------------------------------
        Jan Melander
        WM-Data
        jan.melander@got.wmdata.se
---------------------------------------------------------------
"Until the circle breaks and wisdom lies ahead,
 The faithful live Awake, the rest remain misled"
                Innocence Faded - Dream Theater





Mike Sargent -- msargent@entrust.com
Tuesday, March 04, 1997

Tab settings in Rich Text edit controls are specified in twips. If
you're not familiar with twips, the name is short for "twentieth of a
point". There are 72.27 typographers pointers per inch. In the computer
world we normally use just 72. So an inch contains 72*20 = 1440 twips.
The 720 number mentioned means 1/2 inch, and 120 means 1/12 inch. A
tabsize of 6 times 120 is 720, giving tab spacing every 1/2 inch.

	Mike

>----------
>From: 	JCS@ficsgrp.com[SMTP:JCS@ficsgrp.com]
>Sent: 	Monday, March 03, 1997 12:42 PM
>To: 	mfc-l@netcom.com; jan.melander@got.wmdata.se
>Subject: 	RE: Tabs in a CRichEditCtr?
>
>
>Hi Jan,
>
>This topic puzzles me also. I currently implemented this as follows (and   
>works fine), but there must be an easier way.
>
>REMARK: this example is for a tabsize of  6.
>
>Jan Castermans
>FICS Group, Belgium
>
> /* SET THE TABS */
> GetRichEditCtrl().HideSelection(TRUE,FALSE);
>  GetRichEditCtrl().SetSel(0,-1);
>
> PARAFORMAT pf;
>
> GetRichEditCtrl().GetParaFormat(pf);
>
> pf.cTabCount = MAX_TAB_STOPS;
>
> // I don't know what the meaning of this 120 is, but when I looked
> // into the default setting for this rgxTabs it gave me the value
> // 720 for a tabsize of 6 (and 720 divided by 6 is, yes, yes --> 120)
> // Remark: the font is Courier New 10
> 
> CMyApp* theCurrentApp = (CMyApp*)AfxGetApp();
>
> UINT TabSize = theCurrentApp->m_tabSize;
>
> for(SHORT tab_pos = 0; tab_pos < pf.cTabCount; tab_pos++ )
> {
>  pf.rgxTabs[tab_pos] = (120 * TabSize) * (tab_pos + 1);
> }
>
> pf.dwMask|=PFM_TABSTOPS;
>
> GetRichEditCtrl().SetParaFormat(pf);
>
>  GetRichEditCtrl().SetSel(0,0);
>
> GetRichEditCtrl().HideSelection(FALSE,FALSE);
>
>
> ----------
>From:  Jan Melander
>Sent:  donderdag 27 februari 1997 17:22
>To:  MFC
>Subject:  Tabs in a CRichEditCtr?
>
>Environment : NT 4.0, MSVC++ 4.1
>
>Help!
>
>I have used a CRichEditCtrl to create a text editor view and I have tried
>to activate tab stops in the control, as default the tab key does   
>nothing.
>
>I have used GetParaFormat to get the PARAFORMAT struct then I put some
>tab position in the rgxTabs array, the no. of tabs in cTabCount and add
>PFM_TABSTOPS to the dwMask.
>
>I then read the text into the ctrl, select all the text with SetSel(0,
> -1), and tries to set the new format with SetParaFormat.
>
>But the tab key still does nothing in the Ctrl...
>
>I have noticed that as default values I get 1 in the cTabCount and 720 in
>the first index of the rgxTabs array, what's up?
>
>I got a tip from David Elliot that the problem why the tab key don't work   
>
>might not be connected with the paragraph format, any one got a clue   
>here?
>
>Any help are appreciated!
>
>Cheers,
>
>
> ---------------------------------------------------------------
>        Jan Melander
>        WM-Data
>        jan.melander@got.wmdata.se
> ---------------------------------------------------------------
>"Until the circle breaks and wisdom lies ahead,
> The faithful live Awake, the rest remain misled"
>                Innocence Faded - Dream Theater
>
>




Become an MFC-L member | Вернуться в корень Архива |