mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:19:32 +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;
|
||||
FAutoSelect := True;
|
||||
FAutoSelected := False;
|
||||
FTextChangedByRealSetText := False;
|
||||
FTextChangedByRealSetTextCounter := 0;
|
||||
AutoSize := True;
|
||||
// Accessibility
|
||||
AccessibleRole := larTextEditorSingleline;
|
||||
@ -548,10 +548,11 @@ begin
|
||||
if (FEmulatedTextHintStatus=thsShowing) and (AValue<>'') then
|
||||
HideEmulatedTextHint;
|
||||
|
||||
FTextChangedByRealSetText := True;
|
||||
Inc(FTextChangedByRealSetTextCounter);
|
||||
Modified := False;
|
||||
inherited RealSetText(AValue);
|
||||
FTextChangedByRealSetText := False;
|
||||
Dec(FTextChangedByRealSetTextCounter);
|
||||
if (FTextChangedByRealSetTextCounter < 0) then FTextChangedByRealSetTextCounter := 0;
|
||||
|
||||
if (FEmulatedTextHintStatus=thsHidden) and CanShowEmulatedTextHint then
|
||||
ShowEmulatedTextHint;
|
||||
@ -601,7 +602,7 @@ begin
|
||||
begin
|
||||
if ([csLoading,csDestroying]*ComponentState=[]) then
|
||||
begin
|
||||
if not FTextChangedByRealSetText then
|
||||
if (FTextChangedByRealSetTextCounter = 0) then
|
||||
Modified := True;
|
||||
Change;
|
||||
end;
|
||||
|
@ -8269,7 +8269,11 @@ begin
|
||||
begin
|
||||
WSSetText(AValue);
|
||||
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;
|
||||
end
|
||||
else inherited RealSetText(AValue);
|
||||
|
@ -727,7 +727,7 @@ type
|
||||
FOnChange: TNotifyEvent;
|
||||
FSelLength: integer;
|
||||
FSelStart: integer;
|
||||
FTextChangedByRealSetText: Boolean;
|
||||
FTextChangedByRealSetTextCounter: Integer;
|
||||
FTextHint: TTranslateString;
|
||||
function GetTextHintFontColor: TColor; //Remove in 1.9
|
||||
function GetTextHintFontStyle: TFontStyles; //Remove in 1.9
|
||||
|
Loading…
Reference in New Issue
Block a user