I want a TPageControl and some TTabSheets, with 'per tabsheet' tooltip hints visible as I hover over each tab in turn.
Is there any way of getting this effect in Delphi 2009?
I want a TPageControl and some TTabSheets, with 'per tabsheet' tooltip hints visible as I hover over each tab in turn.
Is there any way of getting this effect in Delphi 2009?
1 - fill in the .Hint property, and set the .ShowHint property to True for the PageControl (assuming each tabsheet has ParentShowHint set to true; otherwise you'll have to set each page individually).
2 - Assign this event to the PageControl's OnChange event handler:
procedure TForm1.PageControl1Change(Sender: TObject);
begin
PageControl1.Hint := PageControl1.ActivePage.Hint;
end;
After you do that, the hint will be whatever the active tab is. I am not sure how to make it change the hint based on where the mouse is hovering - that's an interesting phenomenon I've never noticed before, actually.
Just hook the Page Control's Mouse Move event and use the TabAtPos property to determine which tab the mouse is hovering over. Then assign that tab's Hint to the Page Control's hint property.
procedure TForm.PageControlMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
tabindex: Integer;
begin
tabindex := PageControl.IndexOfTabAt( X, Y );
if tabindex >= 0 then
PageControl.Hint:=PageControl.Pages[tabindex].Hint
end;
In Raize Components, this can be accomplished by setting the trzpagecontrol.tabhints
property to true
. Good components can save you a lot of time (therefore money).
(just a happy customer, btw)