Link to home
Start Free TrialLog in
Avatar of shawn857
shawn857

asked on

Adding Subscript/Superscript to a Richedit...

Hi, I don't know if it's possible but I'd like to be able to add a superscript and subscript characters, to a character in a TRichedit. Googling around I've seen some articles outlining some methods that I haven't really tested yet. I'm wondering if the subscript/superscript additions would still be within the "realm" of the one character they were attached to (which is what I'm wanting)... or do the subscript/superscript occupy their own separate character positions within the RichEdit? Ideally I'd like each character of my RichEdit to have both a superscript and a subscript, to which I could assign separate values to (maybe I'm asking for the moon...).
 
I see there is a component "RxRichEdit" ... wondering if anyone has some experience with that. I've never installed anything from the Jvcl/Jedi package before... it seems like a big deal. Would I have to install all the jedi package, or can I just install this RxRichEdit component?

Thanks!
    Shawn

P.S: I use Delphi 7
ASKER CERTIFIED SOLUTION
Avatar of jimyX
jimyX

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 shawn857
shawn857

ASKER

Hi Jimy, thanks for replying. Yes, each character in the RichEdit having BOTH a subscript and a superscript at the same time - like in the image attached. Is that possible?

Thanks!
     Shawn
supersub.PNG
> "RxRichEdit" ... wondering if anyone has some experience with that.
it seems like a big deal. Would I have to install all the jedi package, or can I just install this RxRichEdit component?

I haven't used this component.
But with jedi package, you have to install the whole thing.
> each character in the RichEdit having BOTH a subscript and a superscript at the same time - like in the image attached. Is that possible?

If that could be done with WordPad it could be done with RichEdit.
Have you tried WordPad?
Let me find out...

PS: I will be away for couple of hours.
I found this article on how to make subscript/superscript in Wordpad:

http://www.keynotesupport.com/pc/word-wordpad-keyboard-shortcuts.shtml

It looks like it treats the subscript (or superscript) as a whole new character.

Thanks
   Shawn
> It looks like it treats the subscript (or superscript) as a whole new character.

I don't think so, again with 'shawn' added as text in WrodPad, and 'w' is subscript-ed, rtf looks:
{\rtf1\fbidis\ansi\ansicpg1256\deff0\nouicompat\deflang1025{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Riched20 6.2.9200}\viewkind4\uc1 
\pard\ltrpar\sa200\sl276\slmult1\f0\fs22\lang9 sha\sub w\nosupersub n\par
}
 

Open in new window


So no new character, the 'w' was stressed with tag "sub".

That doesn't seem possible in WordPad nor in RichEdit, not even with basic MS Word, unless using Add-ons and most likely those add-ons use objects to handle such char complexity combination, similar to math equations. At the end you will be working inside framework that accepts certain set of symbols rather than merely adding characters and apply simple styles on them.
Yeah that sounds like it would be more trouble than it's worth, wouldn't it? Not to worry anyway Jimy - all I had to do was sleep on it last night and I came up with a much more elegant and clean solution to my problem than using subscripts/superscripts! Sorry for the wild goose chase and thank you for your attention.

Cheers
   Shawn
Probably it would have been troublesome.
Glad you sort it out, to the way you like.
:-)