Solved

How do you change TABSTOPS in an edit control?

Posted on 1998-11-23
6
490 Views
Last Modified: 2013-12-03
I've written an application using MASM and I'm trying to change the default tabstops in my edit control
using:

TS    DWORD     40
.
.
.
INVOKE     SendMessage, hREdit, EM_SETTABSTOPS, 1, TS

 The return is zero which means it did not process.
 I don't need to set up an array for variable length Stops.

 Thanks,

 Ewayne
0
Comment
Question by:Eyooper
  • 3
  • 3
6 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 1416270
I'm no expert on MASM but I assume you want the tab stop to bet 40, since when wParam=1 lParam is the distance between TabStops namely 40 dialog units.
   The EM_SETTABSTOPS message positions the tab stops for a MULTILINE EDIT CONTROL. Single line edit controls do not process this message, they just return zero!
0
 

Author Comment

by:Eyooper
ID: 1416271
I'm using a MULTILINE EDIT CONTROL for my text editor program, everything is working great, except I would like to change the tabstop spaces
0
 
LVL 27

Expert Comment

by:BigRat
ID: 1416272
I smell a rat! The hREdit is a handle to Rich Edit control, isn't? In which case you can't use it. Extract from Microsoft documentation :-

EM_SETTABSTOPS (Rich edit controls use the EM_SETPARAFORMAT message instead.)

The EM_SETPARAFORMAT message sets the paragraph formatting for the current selection in a rich edit control.

EM_SETPARAFORMAT
wParam = 0;  // not used; must be zero
lParam = (LPARAM) (PARAFORMAT FAR *) lpFmt;
 
Parameters

lpFmt

Pointer to a PARAFORMAT structure specifying the new paragraph formatting attributes. Only the attributes specified by the dwMask member are changed.

Rich Edit 2.0 and later: This parameter can be a pointer to a PARAFORMAT2 structure, which is an extension of the PARAFORMAT structure. Before sending the EM_SETPARAFORMAT message, set the structure's cbSize member to indicate the version of the structure.

Return Values

Returns a nonzero value if successful, or zero otherwise.

Do you need the data structure or do you have it somewhere?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Eyooper
ID: 1416273
I accept

Thanks
0
 
LVL 27

Accepted Solution

by:
BigRat earned 100 total points
ID: 1416274
PARAFORMAT2

[This is preliminary documentation and subject to change.]

The PARAFORMAT2 structure contains information about paragraph formatting attributes in a rich edit control. PARAFORMAT2 is a rich edit 2.0 extension of the PARAFORMAT structure. Rich edit 2.0 allows you to use either structure with the EM_GETPARAFORMAT and EM_SETPARAFORMAT messages.

typedef struct _paraformat {
    UINT cbSize;
    _WPAD _wPad1;
    DWORD dwMask;
    WORD  wNumbering;
    WORD  wReserved; // redefined as wEffects in PARAFORMAT2
    LONG  dxStartIndent;
    LONG  dxRightIndent;
    LONG  dxOffset;
    WORD  wAlignment;
    SHORT cTabCount;
    LONG  rgxTabs[MAX_TAB_STOPS];
    LONG  dySpaceBefore;     // vertical spacing before para
    LONG  dySpaceAfter;      // vertical spacing after para
    LONG  dyLineSpacing;     // line spacing depending on Rule
    SHORT sStyle;            // style handle
    BYTE  bLineSpacingRule;  // rule for line spacing (see tom.doc)
    BYTE  bCRC;              // reserved for CRC for rapid searching
    WORD  wShadingWeight;    // shading in hundredths of a per cent
    WORD  wShadingStyle;     // nibble 0: style, 1: cfpat, 2: cbpat
    WORD  wNumberingStart;   // starting value for numbering
    WORD  wNumberingStyle;   // alignment, roman/arabic, (), ), ., etc.
    WORD  wNumberingTab;     // space bet 1st indent and 1st-line text
    WORD  wBorderSpace;      // space between border and text (twips)
    WORD  wBorderWidth;      // border pen width (twips)
    WORD  wBorders;          // byte 0: bits specify which borders
                             // nibble 2: border style, 3: color index
} PARAFORMAT2;
#define  wEffects  wReserved
 


Members



cbSize

Specifies the size, in bytes, of this structure. Before passing this structure to a rich edit control, set cbSize to the size of the PARAFORMAT or PARAFORMAT2 structure. If cbSize equals the size of a PARAFORMAT structure, the control uses only the PARAFORMAT members.

dwMask

Specifies the parts of the PARAFORMAT2 structure that contain valid information. The dwMask member can be a combination of the values from two sets of bit flags. One set indicates the structure members that are valid. Another set indicates the valid attributes in the wEffects member.

Set the following values to indicate the valid structure members.
ValueMeaningPFM_ALIGNMENTThe wAlignment member is valid.PFM_BORDERThe wBorderSpace, wBorderWidth, and wBorders members are valid.PFM_LINESPACINGThe dyLineSpacing and bLineSpacingRule members are valid.PFM_NUMBERINGThe wNumbering member is valid.PFM_NUMBERINGSTARTThe wNumberingStart member is valid.PFM_NUMBERINGSTYLEThe wNumberingStyle member is valid.PFM_NUMBERINGTABThe wNumberingTab member is valid.PFM_OFFSETThe dxOffset member is valid.PFM_OFFSETINDENTThe dxStartIndent member is valid. If you are setting the indentation, dxStartIndent specifies the amount to indent relative to the current indentation.PFM_RIGHTINDENTThe dxRightIndent member is valid.PFM_SHADINGThe wShadingWeight and wShadingStyle members are valid.PFM_SPACEAFTERThe dySpaceAfter member is valid.PFM_SPACEBEFOREThe dySpaceBefore member is valid.PFM_STARTINDENTThe dxStartIndent member is valid and specifies the indentation from the left margin. If both PFM_STARTINDENT and PFM_OFFSETINDENT are specified, PFM_STARTINDENT takes precedence.PFM_STYLEThe sStyle member is valid.PFM_TABSTOPSThe cTabCount and rgxTabs members are valid.


Set the following values to indicate the valid attributes of the wEffects member.
ValueMeaningPFM_DONOTHYPHENThe PFE_DONOTHYPHEN value is valid.PFM_KEEPThe PFE_KEEP value is valid.PFM_KEEPNEXTThe PFE_KEEPNEXT value is valid.PFM_NOLINENUMBERThe PFE_NOLINENUMBER value is valid.PFM_NOWIDOWCONTROLThe PFE_NOWIDOWCONTROL value is valid.PFM_PAGEBREAKBEFOREThe PFE_PAGEBREAKBEFORE value is valid.PFM_RTLPARAThe PFE_RTLPARA value is valid.PFM_SIDEBYSIDEThe PFE_SIDEBYSIDE value is valid.PFM_TABLEThe PFE_TABLEROW, PFE_TABLECELLEND, and PFE_TABLECELL values are valid.


wNumbering

Specifies the options for bulleted or numbered paragraphs. To use this member, set the PFM_NUMBERING flag in the dwMask member. This member can be one of the following values.
ValueMeaningzeroNo paragraph numbering or bullets.PFN_BULLETInsert a bullet at the beginning of each selected paragraph.


Rich edit controls do not display paragraph numbers. However, for compatibility with Microsoft Text Object Model (TOM) interfaces, wNumbering can specify one of the following values; the rich edit control stores the value but does not use it to display the text.
ValueMeaning2Use Arabic numbers (1, 2, 3, ...). 3Use lowercase letters (a, b, c, ...). 4Use uppercase letters (A, B, C, ...). 5Use lowercase Roman numerals (i, ii, iii, ...). 6Use uppercase Roman numerals (I, II, III, ...). 7Use a sequence of characters beginning with the Unicode character specified by the wNumberingStart member.


wReserved or wEffects

Rich Edit 2.0: A set of bit flags that specify paragraph effects. These flags are included only for compatibility with TOM interfaces; the rich edit control stores the value but does not use it to display the text.

This member can be a combination of the following values.
ValueMeaningPFE_DONOTHYPHENDisable automatic hyphenation.PFE_KEEPNo page break within the paragraph.PFE_KEEPNEXTNo page break between this paragraph and the next.PFE_NOLINENUMBERDisable line numbering.PFE_NOWIDOWCONTROLDisable widow/orphan control for this paragraph.PFE_PAGEBREAKBEFOREInsert a page break before this paragraph.PFE_RTLPARADisplay text using right-to-left reading order.PFE_SIDEBYSIDEDisplay paragraphs side-by-side.PFE_TABLECELLThe paragraph is in a table cell, but is not the last paragraph in the cell.PFE_TABLECELLENDThe paragraph is last in a table cell.PFE_TABLEROWThe paragraph describes a row in a table.


Rich Edit 1.0: Reserved; must be zero.

dxStartIndent

Specifies the indentation, in twips, of the paragraph's first line. The indentation of subsequent lines depends on the dxOffset member. To use the dxStartIndent member, set the PFM_STARTINDENT or PFM_OFFSETINDENT flag in the dwMask member.

If you are setting the indentation, use the PFM_STARTINDENT flag to specify an absolute indentation from the left margin; or use the PFM_OFFSETINDENT flag to specify an indentation relative to the paragraph's current indentation. Use either flag to retrieve the current indentation.

dxRightIndent

Specifies the indentation, in twips, of the right side of the paragraph, relative to the right margin. To use this member, set the PFM_RIGHTINDENT flag in the dwMask member.

dxOffset

Specifies the indentation, in twips, of the second and subsequent lines, relative to the indentation of the first line. The first line is indented if this member is negative, or outdented is this member is positive. To use this member, set the PFM_OFFSET flag in the dwMask member.

wAlignment

Specifies the paragraph alignment. To use this member, set the PFM_ALIGNMENT flag in the dwMask member. This member can be one of the following values.
ValueMeaningPFA_LEFTParagraphs are aligned with the left margin.PFA_RIGHTParagraphs are aligned with the right margin.PFA_CENTERParagraphs are centered.PFA_JUSTIFYRich Edit 2.0: Paragraphs are justified. This value is included for compatibility with TOM interfaces; rich edit controls display the text aligned with the left margin.


cTabCount

Specifies the number of tab stops defined in the rgxTabs array.

rgxTabs

An array of absolute tab stop positions. Each element in the array specifies information about a tab stop. The 24 low-order bits specify the absolute offset in twips. To use this member, set the PFM_TABSTOPS flag in the dwMask member.

Rich Edit 2.0: For compatibility with TOM interfaces, you can use the 8 high-order bits to store additional information about each tab stop. These bits do not affect the rich edit control display.

Bits 24-27 can specify one of the following values to indicate the tab alignment.
ValueMeaning0Ordinary tab1Center tab2Right-aligned tab3Decimal tab4Word bar tab (vertical bar)


Bits 28-31 can specify one of the following values to indicate the type of tab leader.
ValueMeaning0No leader1Dotted leader2Dashed leader3Underlined leader4Thick line leader5Double line leader


dySpaceBefore

Specifies the size, in twips, of the spacing above the paragraph. To use this member, set the PFM_SPACEBEFORE flag in the dwMask member.

dySpaceAfter

Specifies the size, in twips, of the spacing below the paragraph. To use this member, set the PFM_SPACEAFTER flag in the dwMask member.

dyLineSpacing

Specifies the spacing between lines. For a description of how this value is interpreted, see the bLineSpacingRule member. To use this member, set the PFM_LINESPACING flag in the dwMask member.

sStyle

Specifies the text style. To use this member, set the PFM_STYLE flag in the dwMask member. This member is included only for compatibility with TOM interfaces and Microsoft Word; the rich edit control stores the value but does not use it to display the text.

bLineSpacingRule

Specifies the type of line spacing. To use this member, set the PFM_SPACEAFTER flag in the dwMask member. This member can be one of the following values.
ValueMeaning0Single spacing. The dyLineSpacing member is ignored.1One and a half spacing. The dyLineSpacing member is ignored.2Double spacing. The dyLineSpacing member is ignored.3The dyLineSpacing member specifies the spacing, in twips, from one line to the next. However, if dyLineSpacing specifies a value that is less than single spacing, the control displays single-spaced text.4The dyLineSpacing member specifies the spacing, in twips, from one line to the next. The control uses the exact spacing specified, even if dyLineSpacing specifies a value that is less than single spacing.5The value of dyLineSpacing / 20 is the spacing, in lines, from one line to the next. Thus, setting dyLineSpacing to 20 produces single-spaced text, 40 is double-spaced, 60 is triple-spaced, and so on.


bCRC

Reserved.

wShadingWeight

Specifies a value between zero and 100 to indicate the percent of foreground color to use in shading. The wShadingStyle member specifies the foreground and background shading colors. A value of 5 indicates a shading color consisting of 5 percent foreground color and 95 percent background color. To use these members, set the PFM_SHADING flag in the dwMask member. This member is included only for compatibility with Microsoft Word; the rich edit control stores the value but does not use it to display the text.

wShadingStyle

Specifies the style and colors used for background shading. Bits 0 to 3 contain the shading style, bits 4 to 7 contain the foreground color index, and bits 8 to 11 contain the background color index. To use this member, set the PFM_SHADING flag in the dwMask member. This member is included only for compatibility with Microsoft Word; the rich edit control stores the value but does not use it to display the text.

The shading style can be one of the following values.
ValueMeaningValueMeaning0None1Dark horizontal7Light horizontal2Dark vertical8Light vertical3Dark down diagonal9Light down diagonal4Dark up diagonal10Light up diagonal5Dark grid11Light grid6Dark trellis12Light trellis


The foreground and background color indexes can be one of the following values.
ValueColorValueColor0Black8Dark blue1Blue9Dark cyan2Cyan10Dark green3Green11Dark magenta4Magenta12Dark red5Red13Dark yellow6Yellow14Dark gray7White15Light gray


wNumberingStart

Specifies the starting number or Unicode value to use for numbered paragraphs. Use this member in conjunction with the wNumbering member. This member is included only for compatibility with TOM interfaces; the rich edit control stores the value but does not use it to display the text or bullets. To use this member, set the PFM_NUMBERINGSTART flag in the dwMask member.

wNumberingStyle

Specifies the numbering style to use with numbered paragraphs. Use this member in conjunction with the wNumbering member. This member is included only for compatibility with TOM interfaces; the rich edit control stores the value but does not use it to display the text or bullets. To use this member, set the PFM_NUMBERINGSTYLE flag in the dwMask member. This member can be one of the following values.
ValueMeaning0Follow number with a right parenthesis.1Follow number with period.2Enclose number in parentheses.0x8000Force Roman numerals.


wNumberingTab

Specifies the minimum space, in twips, between a paragraph number and the paragraph text. Use this member in conjunction with the wNumbering member. This member is included only for compatibility with TOM interfaces; the rich edit control stores the value but does not use it to display text. To use this member, set the PFM_NUMBERINGTAB flag in the dwMask member.

wBorderSpace

Specifies the space, in twips, between the border and the paragraph text. The wBorderSpace, wBorderWidth, and wBorders members are included for compatibility with Microsoft Word; the rich edit control stores the values but does not use them to display text. To use this member, set the PFM_BORDER flag in the dwMask member.

wBorderWidth

Specifies the width, in twips, of the border. To use this member, set the PFM_BORDER flag in the dwMask member.

wBorders

Specifies the location, style, and color of the border. Bits 0 to 7 specify the border locations, bits 8 to 11 specify the border style, and bits 12 to 15 specify the border color index. To use this member, set the PFM_BORDER flag in the dwMask member.

Specify the border locations using a combination of the following values.
ValueMeaning1Left border2Right border4Top border8Bottom border16Inside borders32Outside borders64Autocolor. If this bit is set, the color index in bits 12 to 15 is not used.


Specify the border style using one of the following values.
ValueStyleValueStyle0None66 point1> point7> point double21= point81= point double32< point92< point double43 point10> point gray54= point11> point gray dashed


Specify the border color using one of the following values. This value is ignored if the autocolor bit (bit 6) is set.
ValueColorValueColor0Black8Dark blue1Blue9Dark cyan2Cyan10Dark green3Green11Dark magenta4Magenta12Dark red5Red13Dark yellow6Yellow14Dark gray7White15Light gray




QuickInfo

  Windows NT: Requires version 4.0 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in richedit.h.

 regards
 BigRat
0
 

Author Comment

by:Eyooper
ID: 1416275
Adjusted points to 100
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now