trichview.com

trichview.support




Re: Subscript / Superscript Actions?


Return to index


Author

Message

Sergey Tkachenko

Posted: 03/10/2005 23:15:21


Partially.

You can modify vertical position of the selected text (move it up or down),

but you cannot increase/decrease size by 2 (or any other ratio)

TrvActionFontEx can only apply the specified font size.


The code for superscript action's OnExecute (without changing font size) is:


  rvActionsResource.rvActionFontEx1.UserInterface := False;

  try

    rvActionsResource.rvActionFontEx1.ValidProperties := [rvfimVShift];

    if RVStyle1.TextStyles[RichViewEdit1.CurTextStyleNo].VShift=0 then

      rvActionsResource.rvActionFontEx1.VShift :=45

    else

      rvActionsResource.rvActionFontEx1.VShift :=0;

    rvActionsResource.rvActionFontEx1.ExecuteTarget(RichViewEdit1);

  finally

    rvActionsResource.rvActionFontEx1.UserInterface := True;

  end;


The code for its OnUpdate is


  MySuperscriptAction.Checked :=

RVStyle1.TextStyles[RichViewEdit1.CurTextStyleNo].VShift>0.


(it's assumed that the action is named MySuperscriptAction, it's a standard

TAction)


For the subscript action, all is the same, but -25 instead of 45 in

OnExecute, and <0 instead of <0 in OnUpdate.


Of course, you can create your own action instead of placing TAction and

processing its events.


> Can I change Existing actions (userinterface = false, ...)?





Powered by ABC Amber Outlook Express Converter