mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 23:29:13 +02:00
+ implement TView.TextWidth and TView.CTextWidth via StrWidth and CStrLen
git-svn-id: branches/unicodekvm@48774 -
This commit is contained in:
parent
4944e9296f
commit
75e42870ae
@ -1210,39 +1210,17 @@ END;
|
|||||||
{--TView--------------------------------------------------------------------}
|
{--TView--------------------------------------------------------------------}
|
||||||
{ TextWidth -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Nov99 LdB }
|
{ TextWidth -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 25Nov99 LdB }
|
||||||
{---------------------------------------------------------------------------}
|
{---------------------------------------------------------------------------}
|
||||||
{$ifdef FV_UNICODE}
|
|
||||||
FUNCTION TView.TextWidth (const Txt: UnicodeString): Sw_Integer;
|
FUNCTION TView.TextWidth (const Txt: Sw_String): Sw_Integer;
|
||||||
BEGIN
|
BEGIN
|
||||||
TextWidth := Length(Txt); { Calc text length }
|
TextWidth := StrWidth(Txt);
|
||||||
END;
|
END;
|
||||||
|
|
||||||
FUNCTION TView.CTextWidth (const Txt: UnicodeString): Sw_Integer;
|
FUNCTION TView.CTextWidth (const Txt: Sw_String): Sw_Integer;
|
||||||
VAR I: Sw_Integer; S: UnicodeString;
|
VAR I: Sw_Integer; S: UnicodeString;
|
||||||
BEGIN
|
BEGIN
|
||||||
S := Txt; { Transfer text }
|
CTextWidth := CStrLen(Txt);
|
||||||
Repeat
|
|
||||||
I := Pos('~', S); { Check for tilde }
|
|
||||||
If (I <> 0) Then System.Delete(S, I, 1); { Remove the tilde }
|
|
||||||
Until (I = 0); { Remove all tildes }
|
|
||||||
CTextWidth := Length(S); { Calc text length }
|
|
||||||
END;
|
END;
|
||||||
{$else FV_UNICODE}
|
|
||||||
FUNCTION TView.TextWidth (const Txt: String): Sw_Integer;
|
|
||||||
BEGIN
|
|
||||||
TextWidth := Length(Txt); { Calc text length }
|
|
||||||
END;
|
|
||||||
|
|
||||||
FUNCTION TView.CTextWidth (const Txt: String): Sw_Integer;
|
|
||||||
VAR I: Sw_Integer; S: String;
|
|
||||||
BEGIN
|
|
||||||
S := Txt; { Transfer text }
|
|
||||||
Repeat
|
|
||||||
I := Pos('~', S); { Check for tilde }
|
|
||||||
If (I <> 0) Then System.Delete(S, I, 1); { Remove the tilde }
|
|
||||||
Until (I = 0); { Remove all tildes }
|
|
||||||
CTextWidth := Length(S); { Calc text length }
|
|
||||||
END;
|
|
||||||
{$endif FV_UNICODE}
|
|
||||||
|
|
||||||
{--TView--------------------------------------------------------------------}
|
{--TView--------------------------------------------------------------------}
|
||||||
{ MouseInView -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB }
|
{ MouseInView -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 12Sep97 LdB }
|
||||||
|
Loading…
Reference in New Issue
Block a user