Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • Lazarus Lazarus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 2,083
    • Issues 2,083
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 8
    • Merge requests 8
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 is launching on May 22! This version brings many exciting improvements, but also removes deprecated features and introduces breaking changes that may impact your workflow. To see what is being deprecated and removed, please visit Breaking changes in 15.0 and Deprecations.

  • FPC
  • Lazarus
  • LazarusLazarus
  • Issues
  • #30343
Closed
Open
Created Jul 04, 2016 by FPC Admin account@fpc_adminOwner

TPageControl.IndexofTabAt returning wrong values when some tabs are hidden.

Original Reporter info from Mantis: OldRuby
  • Reporter name: Colin Liebenrood

Description:

TPageControl.IndexofTabAt returning wrong values when some tabs are hidden.

Example: 16 tabs (0..15) with tabs 4..9 and 12 hidden. Mouse over tab 10 (5th visible) returns 11, should be 10.

The cause is in function TabIndexAtClientPos in file C:\lazarus\lcl\include\customnotebook.inc, where
the return vaule is calculated. The following rewrite of this function returns the correct value.

TCustomTabControl.TabIndexAtClientPos(ClientPos: TPoint): integer;
var
  i, TabIx, VisiblePageInd: Integer;
begin
  if HandleAllocated then begin
    TabIx:=TWSCustomTabControlClass(WidgetSetClass).GetTabIndexAtPos(Self, ClientPos);
    // TabIx is the index in visible tabs because invisible tabs are removed
    //  from the native control. Calculate the real tab index here.
    VisiblePageInd:=-1;
    for i:=0 to PageCount-1 do
      if Page[i].TabVisible then begin
        Inc(VisiblePageInd);
        if VisiblePageInd = TabIx then begin
          Result := i;
          Break
        end
      end
  end else
    Result:=-1;
end;

Mantis conversion info:

  • Mantis ID: 30343
  • OS Build: 7 Professional
  • Platform: Win32
  • Version: 1.4.2
  • Fixed in revision: r53950 (#f723ac55)
  • Target version: 1.6.4
Assignee
Assign to
Time tracking