Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

Actionlist-question

Dear experts,

I use a actionlist in my application, the use these items:
->Undo
->Cut
->Copy
->Paste
->SelectAll
->Delete
->Bullets
They are all hooked up to my menu-items.

But I want also a menu-item for numbering text.
Like the bullets, but then numbers. Only the actionlist
contains no such item. What do I have to do to make one?

Peter
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

There is no Standard action for the Richedit numbering.
You have to create a new Action and add the following code

procedure TMainForm.Action1Execute(Sender: TObject);
var
  fmt: TParaformat2;
begin
  FillChar(fmt, SizeOf(fmt), 0);
  fmt.cbSize := SizeOf(fmt);

  // The PARAFORMAT2 structure is used to set the numbering style.

  // This is done through the following structure members:
  fmt.dwMask := PFM_NUMBERING or PFM_NUMBERINGSTART or PFM_NUMBERINGSTYLE or PFM_NUMBERINGTAB;

  // Set the following values (bitwise-or them together) to identify

  // which of the remaining structure members are valid:

  // PFM_NUMBERING, PFM_NUMBERINGSTART, PFM_NUMBERINGSTYLE, and PFM_NUMBERINGTAB
  fmt.wNumbering := 2;

  // 0 no numbering or bullets

  // 1 (PFN_BULLET) uses bullet character

  // 2 Uses Arabic numbers (1, 2, 3, ...).

  // 3 Uses lowercase letters (a, b, c, ...).

  // 4 Uses uppercase letters (A, B, C, ...).

  // 5 Uses lowercase Roman numerals (i, ii, iii, ...).

  // 6 Uses uppercase Roman numerals (I, II, III, ...).

  // 7 Uses a sequence of characters beginning with the Unicode

  // character specified by the wNumberingStart member.
  fmt.wNumberingStart := 1;

  // Starting value for numbering.
  fmt.wNumberingStyle := $200;

  // Styles for numbering:

  // 0 : Follows the number with a right parenthesis.  1)

  // $100 : Encloses the number in parentheses.       (1)

  // $200 : Follows the number with a period.          1.

  // $300 : Displays only the number.                  1

  // $400 : Continues a numbered list without applying the next number or bullet.

  // $8000 : Starts a new number with wNumberingStart.
  fmt.wNumberingTab := 1440 div 4;

  // Minimum space between a paragraph number and the paragraph text, in twips
  RichEdit1.Perform(EM_SETPARAFORMAT, 0, lParam(@fmt));
end;
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peter Kiers

ASKER

Do I have to declare something because I get alot of undeclared identifier;
uses Richedit
Are you using TRichEdit?
Is Richedit in the uses clause?
If not add it.
500 points are comming to you.

Grtz, Peter Kiers