mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 11:28:07 +02:00
* unicode fixes in TInputLine.Valid
git-svn-id: branches/unicodekvm@48619 -
This commit is contained in:
parent
1a643e250a
commit
f64bd5c079
@ -1410,11 +1410,11 @@ FUNCTION TInputLine.Valid (Command: Word): Boolean;
|
|||||||
FUNCTION AppendError (AValidator: PValidator): Boolean;
|
FUNCTION AppendError (AValidator: PValidator): Boolean;
|
||||||
BEGIN
|
BEGIN
|
||||||
AppendError := False; { Preset false }
|
AppendError := False; { Preset false }
|
||||||
If (Data <> Nil) Then
|
If Data <> Sw_PString_Empty Then
|
||||||
With AValidator^ Do
|
With AValidator^ Do
|
||||||
If (Options AND voOnAppend <> 0) AND { Check options }
|
If (Options AND voOnAppend <> 0) AND { Check options }
|
||||||
(CurPos <> Length(Data^)) AND { Exceeds max length }
|
(CurPos <> Length(Data Sw_PString_DeRef)) AND { Exceeds max length }
|
||||||
NOT IsValidInput(Data^, True) Then Begin { Check data valid }
|
NOT IsValidInput(Data Sw_PString_DeRef, True) Then Begin { Check data valid }
|
||||||
Error; { Call error }
|
Error; { Call error }
|
||||||
AppendError := True; { Return true }
|
AppendError := True; { Return true }
|
||||||
End;
|
End;
|
||||||
@ -1422,13 +1422,13 @@ FUNCTION TInputLine.Valid (Command: Word): Boolean;
|
|||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
Valid := Inherited Valid(Command); { Call ancestor }
|
Valid := Inherited Valid(Command); { Call ancestor }
|
||||||
If (Validator <> Nil) AND (Data <> Nil) AND { Validator present }
|
If (Validator <> Nil) AND (Data <> Sw_PString_Empty) AND { Validator present }
|
||||||
(State AND sfDisabled = 0) Then { Not disabled }
|
(State AND sfDisabled = 0) Then { Not disabled }
|
||||||
If (Command = cmValid) Then { Valid command }
|
If (Command = cmValid) Then { Valid command }
|
||||||
Valid := Validator^.Status = vsOk { Validator result }
|
Valid := Validator^.Status = vsOk { Validator result }
|
||||||
Else If (Command <> cmCancel) Then { Not cancel command }
|
Else If (Command <> cmCancel) Then { Not cancel command }
|
||||||
If AppendError(Validator) OR { Append any error }
|
If AppendError(Validator) OR { Append any error }
|
||||||
NOT Validator^.Valid(Data^) Then Begin { Check validator }
|
NOT Validator^.Valid(Data Sw_PString_DeRef) Then Begin { Check validator }
|
||||||
Select; { Reselect view }
|
Select; { Reselect view }
|
||||||
Valid := False; { Return false }
|
Valid := False; { Return false }
|
||||||
End;
|
End;
|
||||||
|
@ -145,15 +145,20 @@ TYPE
|
|||||||
{---------------------------------------------------------------------------}
|
{---------------------------------------------------------------------------}
|
||||||
{ SHORT/ANSI/UNICODE SWITCHED STRING TYPE }
|
{ SHORT/ANSI/UNICODE SWITCHED STRING TYPE }
|
||||||
{---------------------------------------------------------------------------}
|
{---------------------------------------------------------------------------}
|
||||||
TYPE
|
|
||||||
{$IFDEF FV_UNICODE}
|
{$IFDEF FV_UNICODE}
|
||||||
|
TYPE
|
||||||
Sw_String = UnicodeString;
|
Sw_String = UnicodeString;
|
||||||
Sw_PString = UnicodeString;
|
Sw_PString = UnicodeString;
|
||||||
Sw_ExtendedGraphemeCluster = UnicodeString;
|
Sw_ExtendedGraphemeCluster = UnicodeString;
|
||||||
|
CONST
|
||||||
|
Sw_PString_Empty = '';
|
||||||
{$ELSE FV_UNICODE}
|
{$ELSE FV_UNICODE}
|
||||||
|
TYPE
|
||||||
Sw_String = ShortString;
|
Sw_String = ShortString;
|
||||||
Sw_PString = PShortString;
|
Sw_PString = PShortString;
|
||||||
Sw_ExtendedGraphemeCluster = Char;
|
Sw_ExtendedGraphemeCluster = Char;
|
||||||
|
CONST
|
||||||
|
Sw_PString_Empty = Nil;
|
||||||
{$ENDIF FV_UNICODE}
|
{$ENDIF FV_UNICODE}
|
||||||
|
|
||||||
{---------------------------------------------------------------------------}
|
{---------------------------------------------------------------------------}
|
||||||
|
@ -177,6 +177,14 @@ FOR FPC THESE ARE THE TRANSLATIONS
|
|||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
{$mode objfpc}
|
{$mode objfpc}
|
||||||
|
|
||||||
|
{$MACRO ON}
|
||||||
|
|
||||||
|
{$IFDEF FV_UNICODE}
|
||||||
|
{$DEFINE Sw_PString_DeRef:=}
|
||||||
|
{$ELSE FV_UNICODE}
|
||||||
|
{$DEFINE Sw_PString_DeRef:=^}
|
||||||
|
{$ENDIF FV_UNICODE}
|
||||||
|
|
||||||
{$UNDEF PROC_Real}
|
{$UNDEF PROC_Real}
|
||||||
{$DEFINE PROC_Protected}
|
{$DEFINE PROC_Protected}
|
||||||
{$IFNDEF CPU16}
|
{$IFNDEF CPU16}
|
||||||
|
Loading…
Reference in New Issue
Block a user