mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:39:23 +02:00
Merged revision(s) 56181 #c5637ad72a from trunk:
Fix firing an OnChange and setting Modified when setting Text inside OnChange and new Text = old Text. Issue #0032602. ........ git-svn-id: branches/fixes_1_8@56239 -
This commit is contained in:
parent
643398e6f9
commit
8e9ba054d3
@ -81,7 +81,7 @@ begin
|
|||||||
BorderStyle := bsSingle;
|
BorderStyle := bsSingle;
|
||||||
FAutoSelect := True;
|
FAutoSelect := True;
|
||||||
FAutoSelected := False;
|
FAutoSelected := False;
|
||||||
FTextChangedByRealSetText := False;
|
FTextChangedByRealSetTextCounter := 0;
|
||||||
AutoSize := True;
|
AutoSize := True;
|
||||||
// Accessibility
|
// Accessibility
|
||||||
AccessibleRole := larTextEditorSingleline;
|
AccessibleRole := larTextEditorSingleline;
|
||||||
@ -548,10 +548,11 @@ begin
|
|||||||
if (FEmulatedTextHintStatus=thsShowing) and (AValue<>'') then
|
if (FEmulatedTextHintStatus=thsShowing) and (AValue<>'') then
|
||||||
HideEmulatedTextHint;
|
HideEmulatedTextHint;
|
||||||
|
|
||||||
FTextChangedByRealSetText := True;
|
Inc(FTextChangedByRealSetTextCounter);
|
||||||
Modified := False;
|
Modified := False;
|
||||||
inherited RealSetText(AValue);
|
inherited RealSetText(AValue);
|
||||||
FTextChangedByRealSetText := False;
|
Dec(FTextChangedByRealSetTextCounter);
|
||||||
|
if (FTextChangedByRealSetTextCounter < 0) then FTextChangedByRealSetTextCounter := 0;
|
||||||
|
|
||||||
if (FEmulatedTextHintStatus=thsHidden) and CanShowEmulatedTextHint then
|
if (FEmulatedTextHintStatus=thsHidden) and CanShowEmulatedTextHint then
|
||||||
ShowEmulatedTextHint;
|
ShowEmulatedTextHint;
|
||||||
@ -601,7 +602,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if ([csLoading,csDestroying]*ComponentState=[]) then
|
if ([csLoading,csDestroying]*ComponentState=[]) then
|
||||||
begin
|
begin
|
||||||
if not FTextChangedByRealSetText then
|
if (FTextChangedByRealSetTextCounter = 0) then
|
||||||
Modified := True;
|
Modified := True;
|
||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
|
@ -8269,7 +8269,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
WSSetText(AValue);
|
WSSetText(AValue);
|
||||||
InvalidatePreferredSize;
|
InvalidatePreferredSize;
|
||||||
inherited RealSetText(AValue);
|
//don't call inherited (=TControl.)RealSetText(AValue) since it can issue a
|
||||||
|
//second OnChange if RealSetText is called from within OnChange (#0032602)
|
||||||
|
//instead just update FCaption.
|
||||||
|
//WSSetText already makes sure an OnChange will be performed
|
||||||
|
FCaption := AValue;
|
||||||
AdjustSize;
|
AdjustSize;
|
||||||
end
|
end
|
||||||
else inherited RealSetText(AValue);
|
else inherited RealSetText(AValue);
|
||||||
|
@ -727,7 +727,7 @@ type
|
|||||||
FOnChange: TNotifyEvent;
|
FOnChange: TNotifyEvent;
|
||||||
FSelLength: integer;
|
FSelLength: integer;
|
||||||
FSelStart: integer;
|
FSelStart: integer;
|
||||||
FTextChangedByRealSetText: Boolean;
|
FTextChangedByRealSetTextCounter: Integer;
|
||||||
FTextHint: TTranslateString;
|
FTextHint: TTranslateString;
|
||||||
function GetTextHintFontColor: TColor; //Remove in 1.9
|
function GetTextHintFontColor: TColor; //Remove in 1.9
|
||||||
function GetTextHintFontStyle: TFontStyles; //Remove in 1.9
|
function GetTextHintFontStyle: TFontStyles; //Remove in 1.9
|
||||||
|
Loading…
Reference in New Issue
Block a user