You've already forked lazarus-ccr
JvclLaz: Fix hints in TJvTabBar. Forum discussion https://forum.lazarus.freepascal.org/index.php/topic,59064.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8251 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user