diff --git a/components/jvcllaz/run/JvPageComps/jvtabbar.pas b/components/jvcllaz/run/JvPageComps/jvtabbar.pas index d52f156f1..a92352033 100644 --- a/components/jvcllaz/run/JvPageComps/jvtabbar.pas +++ b/components/jvcllaz/run/JvPageComps/jvtabbar.pas @@ -269,6 +269,7 @@ public FAllowUnselected: Boolean; FSelectBeforeClose: Boolean; FPageList: TCustomControl; + FHintLocked: Integer; FOnTabClosing: TJvTabBarClosingEvent; FOnTabSelected: TJvTabBarItemEvent; @@ -434,8 +435,9 @@ public property BorderSpacing; property Constraints; property Cursor; + property ParentShowHint default true; property PopupMenu; - property ShowHint default False; + property ShowHint; property Height; property Hint; property Visible; @@ -611,6 +613,7 @@ begin SetInitialBounds(0, 0, CX, CY); AutoSize := true; + ParentShowHint := true; end; destructor TJvCustomTabBar.Destroy; @@ -1154,6 +1157,7 @@ procedure TJvCustomTabBar.MouseMove(Shift: TShiftState; X, Y: Integer); var Tab: TJvTabBarItem; NewHint: TCaption; + P: TPoint; begin CalcTabsRects; // maybe inefficent if ScrollButtonsMouseMove(Shift, X, Y) then @@ -1172,17 +1176,29 @@ begin SetClosingTab(nil) end; - if (Tab <> nil) and Tab.ShowHint then - NewHint := Tab.Hint - else - NewHint := FHint; - - if NewHint <> inherited Hint then + if ShowHint then begin - Application.CancelHint; - ShowHint := False; - ShowHint := True; - inherited Hint := NewHint; + // Use either the TabBar's hint and the hints of the individual tabs. + if (Tab <> nil) and Tab.ShowHint then + newHint := Tab.Hint + else + newHint := FHint; + + if newHint <> inherited Hint then + begin + // Without the next instruction the currently shown hint will not be replaced. + Application.CancelHint; + + // Move the new hint text to the control, but do not overwrite the + // own hint of the TabBar. + inc(FHintLocked); + inherited Hint := newHint; + dec(FHintLocked); + + // Display the new hint + P := ClientToScreen(Point(X, Y)); + Application.ActivateHint(P, true); + end; end; inherited MouseMove(Shift, X, Y); @@ -1763,8 +1779,13 @@ end; procedure TJvCustomTabBar.SetHint(const Value: TCaption); begin - if Value <> FHint then - FHint := Value; + inherited; + + if FHintLocked = 0 then + begin + if Value <> FHint then + FHint := Value; + end; end; procedure TJvCustomTabBar.SetFlatScrollButtons(const Value: Boolean);