Recent

Author Topic: [SOLVED] Bullets  (Read 559 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
[SOLVED] Bullets
« on: July 04, 2020, 01:34:13 am »
Hi,

Reading this page on Bullets/Numbering.
https://wiki.freepascal.org/RichMemo
I can't seem to figure out how exactly the code needs to be done.

This is what I have, but get error on pn:= line

Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;  
  3. begin
  4.   pn.Style = pnNumber;    //<------ ERROR
  5.   txtNote1.SetParaNumbering( txtNote1.SelStart, txtNote1.SelLength,pn);
  6.   txtNote1.SetFocus();    

Any help would be appreciated
« Last Edit: July 04, 2020, 11:37:32 am by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
Re: Bullets
« Reply #1 on: July 04, 2020, 02:19:42 am »
Hmmm... stumbled upon it by accident.

This works basically.

Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;
  3. begin
  4.   pn.Style:= pnBullet;  //or us pnNone to undo it.
  5.   txtNote1.SetParaNumbering( txtNote1.SelStart, txtNote1.SelLength,pn);

Now I need to figure out how to indent
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
Re: Bullets
« Reply #2 on: July 04, 2020, 03:04:27 am »
Okay.. got the bullets to at least appear... albeit they don't indent yet

Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;
  3.  
  4. begin
  5.  
  6. pn.Indent:=14; //indents text from the right of bullet, not indenting the bullet itself
  7.  
  8. txtNote1.GetParaNumbering(txtNote1.SelStart, pn);
  9. if (pn.Style = pnNone) then
  10.    begin
  11.          pn.Style:= pnBullet; //or pnNumber
  12.           txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  13.    end
  14. else
  15.    begin
  16.          pn.Style:= pnNone; //or pnNumber
  17.          txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  18.     end;
  19.  
  20.  txtNote1.SetFocus();


Now I am stuck on how to indent the bullets themselves (with the text too)

Also when using pnNumber, the numbers first line starts with "0)" and not "1)"


Any help would be appreciated.
« Last Edit: July 04, 2020, 10:47:07 am by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2514
    • havefunsoft.com
Re: Bullets
« Reply #3 on: July 04, 2020, 06:17:52 am »
pn.Indent:=14; //indents text from the right of bullet, not indenting the bullet itself
Code: Pascal  [Select][+][-]
  1. var
  2.   pm:  TParaMetric;
  3. begin
  4.   richMemo1.getParaMetric(txtNote1.SelStart, pm);
  5.   pm.FirstIdent := 36;
  6.   richMemo1.setParamMetric(txtNote1.SelStart, txtNote1.SelLength,pn);
  7.  

Also when using pnNumber, the numbers first line starts with "0)" and not "1)"
Any help would be appreciated.

Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;
  3. begin
  4.   InitParaNumbering(pn);
  5.   pn.NumberStart := 1;
  6.   pn.Style:= pnBullet;  
  7.   txtNote1.SetParaNumbering( txtNote1.SelStart, txtNote1.SelLength,pn);
  8.  
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
Re: Bullets
« Reply #4 on: July 04, 2020, 10:43:33 am »
@skalogry
Thanks for replying
That works!

About space between bullet and text...
However, my "pn.indent" doesn't work any more once I added the Parametric

How come?
And how do I adjust the space in between the bullet and the text?

Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;
  3.   pm:  TParaMetric;
  4. begin
  5.  
  6. pn.Indent:= 14; //indents text from the right of bullet, not indenting the bullet itself
  7.  
  8. txtNote1.GetParaNumbering(txtNote1.SelStart, pn);
  9. txtNote1.getParaMetric(txtNote1.SelStart, pm);
  10.  
  11. if (pn.Style = pnNone) then
  12.    begin
  13.       pn.Style:= pnBullet; //or pnNumber
  14.        pm.FirstLine := 24;
  15.        txtNote1.SetParaMetric(txtNote1.SelStart, txtNote1.SelLength,pm);
  16.        txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  17.    end  
  18. else
  19.    begin
  20.        pn.Style:= pnNone; //or pnNumber
  21.        pm.FirstLine := 0;
  22.        txtNote1.SetParaMetric(txtNote1.SelStart, txtNote1.SelLength,pm);
  23.        txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  24.    end;
  25.  
  26. txtNote1.SetFocus();

See image
« Last Edit: July 04, 2020, 10:47:32 am by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
Re: Bullets
« Reply #5 on: July 04, 2020, 11:07:01 am »
Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;
  3. begin
  4.   InitParaNumbering(pn);
  5.   pn.NumberStart := 1;
  6.   pn.Style:= pnBullet;  
  7.   txtNote1.SetParaNumbering( txtNote1.SelStart, txtNote1.SelLength,pn);
  8.  

Hi,

The starting number is still 0

Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;
  3.   pm:  TParaMetric;
  4. begin
  5.  
  6. InitParaNumbering(pn);
  7. pn.Indent:= 14; //indents text from the right of bullet, not indenting the bullet itself
  8. pn.NumberStart := 1;
  9.  
  10. txtNote1.GetParaNumbering(txtNote1.SelStart, pn);
  11. txtNote1.GetParaMetric(txtNote1.SelStart, pm);
  12.  
  13. if (pn.Style = pnNone) then
  14.    begin
  15.       pn.Style:=pnNumber;
  16.        pm.FirstLine := 24;
  17.        txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  18.        txtNote1.SetParaMetric(txtNote1.SelStart, txtNote1.SelLength,pm);
  19.    end  
  20. else
  21.    begin
  22.        pn.Style:= pnNone; //or pnNumber
  23.        pm.FirstLine := 0;
  24.        txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  25.        txtNote1.SetParaMetric(txtNote1.SelStart, txtNote1.SelLength,pm);
  26.    end;
  27.  
  28. txtNote1.SetFocus();

FYI... I am on Windows 10
« Last Edit: July 04, 2020, 11:08:57 am by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1243
    • Pixelink Software
Re: Bullets
« Reply #6 on: July 04, 2020, 11:29:49 am »
Got it!

I had the placement of the "Indent" in the wrong place

Here is finished working code

BULLETS

Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;
  3.   pm:  TParaMetric;
  4. begin
  5.   InitParaNumbering(pn);
  6.   InitParaMetric(pm);
  7.  
  8.   txtNote1.GetParaNumbering(txtNote1.SelStart, pn);
  9.   txtNote1.getParaMetric(txtNote1.SelStart, pm);
  10.   if (pn.Style = pnNone) then
  11.       begin
  12.           pn.Style:= pnBullet; //or pnNumber or pnNone
  13.           pn.Indent:= 14;
  14.           pm.FirstLine := 24;
  15.           txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  16.           txtNote1.SetParaMetric(txtNote1.SelStart, txtNote1.SelLength,pm);
  17.       end
  18.   else
  19.       begin
  20.           pn.Style:= pnNone;
  21.           pn.Indent:= 14;
  22.           pm.FirstLine := 0;
  23.           txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  24.           txtNote1.SetParaMetric(txtNote1.SelStart, txtNote1.SelLength,pm);
  25.       end;      
  26.  

NUMBERS

Code: Pascal  [Select][+][-]
  1. var
  2.   pn : TParaNumbering;
  3.   pm:  TParaMetric;
  4. begin
  5.  
  6.  InitParaNumbering(pn);
  7.  
  8.  
  9.  txtNote1.GetParaNumbering(txtNote1.SelStart, pn);
  10.  txtNote1.getParaMetric(txtNote1.SelStart, pm);
  11.  if (pn.Style = pnNone) then
  12.      begin
  13.          pn.Style:= pnNumber; //or pnNumber or pnNone
  14.          pn.Indent:= 14;
  15.          pn.NumberStart:= 1;
  16.          pm.FirstLine := 24;
  17.          txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  18.          txtNote1.SetParaMetric(txtNote1.SelStart, txtNote1.SelLength,pm);
  19.      end
  20.  else
  21.      begin
  22.          pn.Style:= pnNone;
  23.          pm.FirstLine := 0;
  24.          txtNote1.SetParaNumbering(txtNote1.SelStart, txtNote1.SelLength,pn);
  25.          txtNote1.SetParaMetric(txtNote1.SelStart, txtNote1.SelLength,pm);
  26.      end;
  27.  

Thanks skalorgyz
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media
LAZ 2.08 •  VSSTUDIO(.Net) 2019 • Win10 • 16G RAM • Nivida GForce RTX 2060

 

TinyPortal © 2005-2018