Designer: Support also (False) and (True) as Boolean values in Undo operation.

git-svn-id: trunk@51634 -
This commit is contained in:
juha 2016-02-15 12:48:54 +00:00
parent 99194561d2
commit ee7305772d
2 changed files with 11 additions and 1 deletions

View File

@ -81,6 +81,7 @@ type
procedure RegisterGetLookupRoot(const OnGetLookupRoot: TGetLookupRoot);
procedure UnregisterGetLookupRoot(const OnGetLookupRoot: TGetLookupRoot);
function StrToBoolOI(S: string): Boolean;
implementation
@ -125,6 +126,15 @@ begin
GetLookupRoots.Remove(OnGetLookupRoot);
end;
function StrToBoolOI(S: string): Boolean;
// Like StrToBool but accepts also '(False)' and '(True)'.
begin
if S = '' then Exit(False);
if (Length(S) > 2) and (S[1] = '(') and (S[Length(S)] = ')') then
S := Copy(S, 2, Length(S)-2);
Result := StrToBool(S);
end;
{ TPersistentSelectionList }
function TPersistentSelectionList.Add(APersistent: TPersistent): integer;

View File

@ -1330,7 +1330,7 @@ procedure TDesigner.ExecuteUndoItem(IsActUndo: boolean);
tkFloat:
SetFloatProp(tmpObj, fieldName, StrToFloat(tmpStr));
tkBool:
SetOrdProp(tmpObj, FUndoList[FUndoCurr].fieldName, Integer(StrToBool(tmpStr)));
SetOrdProp(tmpObj, FUndoList[FUndoCurr].fieldName, Integer(StrToBoolOI(tmpStr)));
tkString, tkLString, tkAString, tkUString, tkWString:
SetStrProp(tmpObj, fieldName, tmpStr);
tkSet: