Richedit justify and numbering style bugs and fixes
Moderator: Rathinagiri
Richedit justify and numbering style bugs and fixes
I have been using HMG rich edit controls heavily for the past few months and have discovered two bugs and fixes for them.
The first bug is that the justify alignment does not work, e.g.
Win.RichEditBox.ParaAlignment := RTF_JUSTIFY
has no effect and does not actually justify the text. After some searching, I found out that you must turn on "advanced typography" to get this to work. The following should be added to InitRichEditBox() in c_richeditbox.c:
SendMessage( hWndControl, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY );
"Advanced typography" sounds like it should be enable a big set of advanced features, but in fact the feature set it enables is quite small, and justification is the main one.
The second bug is that paragraph numbering styles that you get and set with the ParaNumberingStyle property do not match the constants in i_richeditbox.ch, e.g.
Win.RichEditBox.ParaNumberingStyle := RTF_PERIOD
actually sets the numbering style to two parentheses instead of a period. This is due to a mismatch between c_richeditbox.c lines 837-845 and 940-953, and i_richeditbox.ch lines 151-157. In the C code, numbering style 0 and PFNS_PAREN have the same effect, a right parenthesis after the number. So the first case is unnecessary, and the cases should start with PFNS_PAREN, which should be mapped to case 1.
However, I do not think the C code should be modified, as this would break existing applications that use it. Instead, I suggest adding some additional constants to i_richeditbox.ch that reflect the actual values in the C code, e.g.
#define RTF_PAREN_2 3 // Follows the number with a right parenthesis.
I've put suggested fixed versions of i_richeditbox.ch and c_richeditbox.c onto my web site at http://kevincarmody.com/hmg/" onclick="window.open(this.href);return false;
Kevin
The first bug is that the justify alignment does not work, e.g.
Win.RichEditBox.ParaAlignment := RTF_JUSTIFY
has no effect and does not actually justify the text. After some searching, I found out that you must turn on "advanced typography" to get this to work. The following should be added to InitRichEditBox() in c_richeditbox.c:
SendMessage( hWndControl, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY );
"Advanced typography" sounds like it should be enable a big set of advanced features, but in fact the feature set it enables is quite small, and justification is the main one.
The second bug is that paragraph numbering styles that you get and set with the ParaNumberingStyle property do not match the constants in i_richeditbox.ch, e.g.
Win.RichEditBox.ParaNumberingStyle := RTF_PERIOD
actually sets the numbering style to two parentheses instead of a period. This is due to a mismatch between c_richeditbox.c lines 837-845 and 940-953, and i_richeditbox.ch lines 151-157. In the C code, numbering style 0 and PFNS_PAREN have the same effect, a right parenthesis after the number. So the first case is unnecessary, and the cases should start with PFNS_PAREN, which should be mapped to case 1.
However, I do not think the C code should be modified, as this would break existing applications that use it. Instead, I suggest adding some additional constants to i_richeditbox.ch that reflect the actual values in the C code, e.g.
#define RTF_PAREN_2 3 // Follows the number with a right parenthesis.
I've put suggested fixed versions of i_richeditbox.ch and c_richeditbox.c onto my web site at http://kevincarmody.com/hmg/" onclick="window.open(this.href);return false;
Kevin
- serge_girard
- Posts: 3165
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Richedit justify and numbering style bugs and fixes
Thanks Kevin !
Serge
Serge
There's nothing you can do that can't be done...
-
- Posts: 682
- Joined: Tue Jun 04, 2013 6:33 pm
- Location: Argentina
Re: Richedit justify and numbering style bugs and fixes
Hi Kevin:
My first words are: EXCELLENT job.-
I've download and apply new libraries, and it works absolutely fine.-
A suggestion to all users:
1) First rename both original files to individualitate as OLD
2) Copy both libraries each on it's root (INCLUDE and SOURCES)
3) Re Build libraries twice: one choosing ANSI option, and when it finish choose UNICODE
After that, chances take place and you'll enjoy both improvements.
Again Kevin, Excellent Job, and thanks to share with us.-
With regards.
Eduardo
My first words are: EXCELLENT job.-
I've download and apply new libraries, and it works absolutely fine.-
A suggestion to all users:
1) First rename both original files to individualitate as OLD
2) Copy both libraries each on it's root (INCLUDE and SOURCES)
3) Re Build libraries twice: one choosing ANSI option, and when it finish choose UNICODE
After that, chances take place and you'll enjoy both improvements.
Again Kevin, Excellent Job, and thanks to share with us.-
With regards.
Eduardo
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Richedit justify and numbering style bugs and fixes
Hello Mr. Carmodykcarmody wrote:I have been using HMG rich edit controls heavily for the past few months ...
I've put suggested fixed versions of i_richeditbox.ch and c_richeditbox.c onto my web site at http://kevincarmody.com/hmg
...
You are welcome aboard of HMG_Forum
![Smile :)](./images/smilies/icon_e_smile.gif)
Thanks a lot for your valuable participation.
And surely we will benefit by your huge experience and knowledge
![Arrow :arrow:](./images/smilies/icon_arrow.gif)
Happy HMG'ing
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Viva INTERNATIONAL HMG ![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
- danielmaximiliano
- Posts: 2612
- Joined: Fri Apr 09, 2010 4:53 pm
- Location: Argentina
- Contact:
Re: Richedit justify and numbering style bugs and fixes
Gracias / Thanks Kevin....
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Richedit justify and numbering style bugs and fixes
Wow ! Thank you Kevin for you fix of it and sharing with us.
Have you are welcome to our community !![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Nice work in AksharaPad !
![Image](http://www.pctoledo.com.br/forum/images/smilies/pct21.gif)
Have you are welcome to our community !
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Nice work in AksharaPad !
![Image](http://www.pctoledo.com.br/forum/images/smilies/pct21.gif)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Richedit justify and numbering style bugs and fixes
Thank you everyone for your kind words -- including Pablo for noticing my HMG project AksharaPad -- but it looks now like I was wrong about the second bug. There is no mismatch between the constants in i_richeditbox.ch lines 151-157 and the code in c_richeditbox.c lines 837-845 and 940-953. So the second bug I reported does not exist.
However it is still true that RTF_NONE and RTF_PAREN (style numbers 1 and 2) produce the same effect, a right parenthesis. So RTF_NONE is not necessary and is misnamed. The numbering style which eliminates punctuation is RTF_NONUMBER.
I've posted a new version of i_richeditbox.ch, with the proposed additions of RTF_PAREN_2 etc. removed, to my site at http://kevincarmody.com/hmg/" onclick="window.open(this.href);return false;
Kevin
However it is still true that RTF_NONE and RTF_PAREN (style numbers 1 and 2) produce the same effect, a right parenthesis. So RTF_NONE is not necessary and is misnamed. The numbering style which eliminates punctuation is RTF_NONUMBER.
I've posted a new version of i_richeditbox.ch, with the proposed additions of RTF_PAREN_2 etc. removed, to my site at http://kevincarmody.com/hmg/" onclick="window.open(this.href);return false;
Kevin
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: Richedit justify and numbering style bugs and fixes
Thanks Kevin for report the bug and fix.kcarmody wrote:I have been using HMG rich edit controls heavily for the past few months and have discovered two bugs and fixes for them.
The first bug is that the justify alignment does not work, e.g.
Win.RichEditBox.ParaAlignment := RTF_JUSTIFY
has no effect and does not actually justify the text. After some searching, I found out that you must turn on "advanced typography" to get this to work. The following should be added to InitRichEditBox() in c_richeditbox.c:
SendMessage( hWndControl, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY );
"Advanced typography" sounds like it should be enable a big set of advanced features, but in fact the feature set it enables is quite small, and justification is the main one.
The second bug is that paragraph numbering styles that you get and set with the ParaNumberingStyle property do not match the constants in i_richeditbox.ch, e.g.
Win.RichEditBox.ParaNumberingStyle := RTF_PERIOD
actually sets the numbering style to two parentheses instead of a period. This is due to a mismatch between c_richeditbox.c lines 837-845 and 940-953, and i_richeditbox.ch lines 151-157. In the C code, numbering style 0 and PFNS_PAREN have the same effect, a right parenthesis after the number. So the first case is unnecessary, and the cases should start with PFNS_PAREN, which should be mapped to case 1.
However, I do not think the C code should be modified, as this would break existing applications that use it. Instead, I suggest adding some additional constants to i_richeditbox.ch that reflect the actual values in the C code, e.g.
#define RTF_PAREN_2 3 // Follows the number with a right parenthesis.
I've put suggested fixed versions of i_richeditbox.ch and c_richeditbox.c onto my web site at http://kevincarmody.com/hmg/" onclick="window.open(this.href);return false;" onclick="window.open(this.href);return false;
Kevin
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: Richedit justify and numbering style bugs and fixes
Muy bien Kevin, Gracias por ver los errores y contribuir en su corrección.
Bienvenido a HMG.
Saludos desde México.
Bienvenido a HMG.
Saludos desde México.
Re: Richedit justify and numbering style bugs and fixes
Hi Mr. Kevin
Welcome from India
Than you for your contribution
Welcome from India
Than you for your contribution
BPD
Convert Dream into Reality through HMG
Convert Dream into Reality through HMG