Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Subscript & SuperScript

Posted on 1998-04-22
1
Medium Priority
?
821 Views
Last Modified: 2008-02-01
I got a problem here. I can set font in TRichEdit to Superscript or
Subscript, but don't know how to restore it to normal size.
So the question is:
1. How to restore superscript or subscript font to normal size (before it set)?
2. How to detect superscript or subcript font? I mean, if I block a font,
   and it's superscript or superscript then in my TMenuItem it will show
   checkmark.
Here's the program...

procedure TMainForm.SetFontText(IsSuperScript: boolean; SetToNormal: boolean);
var
  format: TCharFormat;
begin
  Editor.Perform(EM_GETCHARFORMAT, SCF_SELECTION, LongInt(@format));
  FillChar(format, sizeof(format), 0);
  with format do begin
    cbSize:= sizeof(format);
    dwMask:= CFM_OFFSET;
    if Not SetToNormal then begin
      if IsSuperScript then
        yOffset:= 60
      else
        yOffset:= -60;
    end else begin
      if IsSuperScript then begin { Procedure pemanggilnya = SuperScript }
        if SuperScript.Checked then begin
          yOffset:= 0;
          SuperScript.Checked:= false
        end;
      end else begin
        if SubScript.Checked then begin { Procedure pemanggilnya = SubScript }
          yOffset:= 0;
          SubScript.Checked:= false
        end;
      end;
    end;
  end;
  Editor.Perform(EM_SETCHARFORMAT, SCF_SELECTION, LongInt(@format));
end;

Thanks experts...

Daniel
0
Comment
Question by:daniel_c
1 Comment
 
LVL 8

Accepted Solution

by:
ZifNab earned 40 total points
ID: 1336310
Hi daniel_C,

Why not storing the font, before you change it to sub/super script? Or something like that?

Regards, Zif.


0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

886 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