JvDockTabPageControl: display form title in tooltip on mouseover tab

I have several forms that taboo in JVDocking Page Control, but the tabs are too small to display the entire title of the form.

In any case, display a tooltip containing the tab text when the tab stops hanging?

The closest I got is a hint for each form:

TJvDockVIDTabPageControl(Form).Pages[i].Hint := 'hint';

and one hint for the entire tab bar:

TJvDockVIDTabPageControl(Form).Panel.Hint := 'hint';
+4
source share
1 answer

You cannot use a tooltip because it does not update the tooltip when navigating tabs. So you need to override TJvDockTabPanel.MouseMove () and do something like this:

inherited MouseMove(Shift, X, Y)
Index := GetPageIndexFromMousePost(X, Y)
// Your code here
if (Index > -1) then
begin
    // Strip hotkey '&' out.
    Hint := StringReplace(Page.Pages[Index].Caption, '&', '', [rfReplaceAll]);
    Application.ActivateHint(ClientToScreen(Point(X, Y)));
end;

JvDockVIDStyle.pas, , , , . , :

unit JvDockExtVIDStyle;

interface

uses JvDockVIDStyle, Classes;

type
    TJvDockExtTabPanel = class(TJvDockTabPanel)
    protected
        procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
    end;

    TJvDockExtVIDTabPageControl = class(TJvDockVIDTabPageControl)
    public
        constructor Create(AOwner: TComponent); override;
    end;

implementation

uses Forms, SysUtils;

{ TJvDockExtVIDTabPageControl }

constructor TJvDockExtVIDTabPageControl.Create(AOwner: TComponent);
begin
    inherited Create(AOwner);
    //Override TabPanel with our subclassed version
    TabPanelClass := TJvDockExtTabPanel;
end;

{ TJvDockExtTabPanel}

procedure TJvDockExtTabPanel.MouseMove(Shift: TShiftState; X, Y: Integer);
var
    Index : Integer;
begin
    inherited MouseMove(Shift, X, Y);

    Index := GetPageIndexFromMousePos(X, Y);
    if (Index > -1) then
    begin
        Hint := StringReplace(Page.Pages[Index].Caption, '&', '', [rfReplaceAll]);
        Application.ActivateHint(ClientToScreen(Point(X, Y)));
    end;
end;

, , TabDockClass -, . :

DockStyle.TabDockClass := TJvDockExtVIDTabPageControl;
DockServer.DockStyle := DockStyle;

VSNET. VID VSNet , , TJvDockVSNetTabPanel TJvDockTabPanel

JVCL . ShowTabHints - true. .

MyDockStyle.ShowTabHints := True;
+3

All Articles