From adf4fa9961122333a7699972213a7d37967079f8 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 20 Aug 2014 23:39:02 +0100 Subject: Fix PageControl bug where left or right tabs are unresponsive to clicks PageControl tabs were on the left or right, and you went over a certain number of tabs, then you couldn't change tabs by clicking with the mouse. The TabSheetAtPos() never took into account the TabPosition, and it always used MaxButtonWidthSum, which is only meant for Top or Bottom postitions. --- src/gui/fpg_tab.pas | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/gui/fpg_tab.pas') diff --git a/src/gui/fpg_tab.pas b/src/gui/fpg_tab.pas index 29addb12..5ef516bb 100644 --- a/src/gui/fpg_tab.pas +++ b/src/gui/fpg_tab.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -1291,10 +1291,7 @@ var begin Result := nil; h := TfpgTabSheet(FPages.First); - lp := FMargin; - if MaxButtonWidthSum > (Width-(FMargin*2)) then - h := FFirstTabButton; case TabPosition of tpTop: @@ -1324,6 +1321,8 @@ begin if TabPosition in [tpTop, tpBottom] then begin + if MaxButtonWidthSum > (Width-(FMargin*2)) then + h := FFirstTabButton; if (y > p1) and (y < p2) then begin while h <> nil do @@ -1346,11 +1345,13 @@ begin if TabPosition in [tpLeft, tpRight] then begin + bh := ButtonHeight; // initialize button height + if MaxButtonHeightSum > (Height-(FMargin*2)) then + h := FFirstTabButton; if (x > p1) and (x < p2) then begin while h <> nil do begin - bh := ButtonHeight; // initialize button height if (y > lp) and (y < lp + bh) then begin if h <> ActivePage then -- cgit v1.2.3-70-g09d2