trichview.com

trichview.support




Re: alternate text for html


Return to index


Author

Message

Sergey Tkachenko

Posted: 05/07/2004 22:27:31


(this example is for the latest version available for registered users;

the public trial version does not have extra string properties such as Alt;

but similar code can be used for working with extra integer properties)


1) Document generation. Works both in TRichView and TRichViewEdit


  RichViewEdit1.Clear;

  ...

  RichViewEdit1.AddPictureEx('', bmp, 0, rvvaBaseline);

  RichViewEdit1.SetItemExtraStrProperty(RichViewEdit1.ItemCount-1, rvespAlt,

'Alt text');

  ...

  RichViewEdit1.Format;


2) Editing alt text of picture at the caret position


  // assuming that  RichViewEdit1.CurItemStyle = rvsPicture, or

rvsHotPicture

  RichViewEdit1.SetCurrentItemExtraStrProperty(rvespAlt, 'Alt text', True);


3) Inserting picture


Simple variant:

  if RichViewEdit1.InsertPicture('', bmp, rvvaBaseline) then

    RichViewEdit1.SetCurrentItemExtraStrProperty(rvespAlt, 'Alt text',

True);


The only problem with it - Undo command will undo this insertion in two

steps (first - alt, then - insertion).

So:


  RichViewEdit1.BeginUndoGroup(rvutInsert);

  RichViewEdit1.SetUndoGroupMode(True);

  try

    if RichViewEdit1.InsertPicture('', bmp, rvvaBaseline) then

      RichViewEdit1.SetCurrentItemExtraStrProperty(rvespAlt, 'Alt text',

True);

  finally

    RichViewEdit1.SetUndoGroupMode(False);

  end;





Powered by ABC Amber Outlook Express Converter