trichview.com

trichview.support




How to Search for an existing FontInfo?


Return to index


Author

Message

Tavo

Posted: 08/28/2002 21:42:59


Hello and sorry for my english


I'm working on an editor wich have not more than one FontInfo (Editor.Style.TextStyles.Count=0).


When I need to add a new TextStyle with a Specified Font, How to Search for

an existing FontInfo? I've try this:


font := TFont.Create ;

Try

  font.Color := clBlue ;

  font.Size  := 8 ;

  font.Name  := 'Courier' ;

  font.Style := [fsBold,fsUnderLine] ;

  NewStyleNo := editor.Style.TextStyles.FindStyleWithFont(0, font);

  if NewStyleNo=-1 then begin

    editor.Style.TextStyles.Add ;

    NewStyleNo := editor.Style.TextStyles.Count-1;

    editor.Style.TextStyles[NewStyleNo].Assign(

                              editor.Style.TextStyles[0] ) ;

    editor.Style.TextStyles[NewStyleNo].Assign(font);

    end;

Finally

   font.Free ;

End ;


This work at first time (I can add a TextStyle) but in a second time �not

find the TextStyle already inserted! and insert another one.


�Wich is my error?


Thanks and a salute from Argentina.

Tavo





Powered by ABC Amber Outlook Express Converter