Reply To: RzPageControl: displaying a hint on the tab rect (or image) only

Home Forums Konopka Signature VCL Controls (formerly Raize Components) RzPageControl: displaying a hint on the tab rect (or image) only Reply To: RzPageControl: displaying a hint on the tab rect (or image) only

#2755
Ray Konopka
Keymaster

    Hi Patrick,

    This is kind of a hack, but it may be good enough for your needs.

    Ray

    type
      TRzPageControlAccess = class( TRzPageControl )
      end;
    
    procedure TForm27.FormCreate(Sender: TObject);
    begin
      Application.OnShowHint := ShowHintHandler;
    end;
    
    procedure TForm27.ShowHintHandler( var HintStr: string; var CanShow: Boolean;
                                       var HintInfo: Vcl.Controls.THintInfo);
    var
      P: TPoint;
      Idx: Integer;
      TabDataList: TRzTabDataList;
    begin
      P := HintInfo.CursorPos;
      Idx := RzPageControl1.TabAtPos( P.X, P.Y );
      if Idx <> -1 then
      begin
        TabDataList := TRzPageControlAccess( RzPageControl1 ).GetTabDataList;
        if P.X < TabDataList.Items[ Idx ].RawRect.Left + 20 then
        begin
          HintStr := 'Tab Image ' + Idx.ToString;
        end
        else
        begin
          HintStr := 'Regular Tab ' + Idx.ToString + ' Hint';
        end;
      end;
    end;