trichview.com

trichview.support




streaming in components


Return to index


Author

Message


Posted: 04/19/2004 6:14:04


Hello,


I have some inserted controls I use with tRichView.


When the user selects text that includes a control, and then changes the

font, I also change the font of the control so it stays in sync. I use the

onCurTextStyleChanged event and it works quite well.


When I save the richview out to RVF I have the rvfoSaveControlsBopy=false.

When I load the richView I create the control in the onRVFControlNeeded

event. That works great.


The question is how to set the font of the inserted control back to what it

was before. I tried to use the onControlAction as follows:


procedure TForm1.RichViewEdit1ControlAction(Sender: TCustomRichView;

  ControlAction: TRVControlAction; ItemNo: Integer; var ctrl: TControl);

var

   newStyle:integer;

begin

   case ControlAction of   

      // resync font with control

      rvcaAfterRVFLoad: begin

         newStyle:= RichViewEdit1.ActualCurTextStyleNo;

         syncControlFontWithStyle(ctrl,newStyle);

      end;

   end;    // case

end;


however, the ActualCurTextStyleNo at that point is not the same as the font

when the control was saved. I also tried


newStyle:= RichViewEdit1.getItem(itemNo).styleNo;

syncControlFontWithStyle(ctrl,newStyle);


but newStyle is -5. if the inserted control was its own item (i.e. I

selected the control on its own and set the font just for the control, so

it got its own itemNo), is there a way when reading the RVF back in to

query what that font was?





Powered by ABC Amber Outlook Express Converter