Changeset 89


Ignore:
Timestamp:
Jan 19, 2017, 8:40:22 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Simplified PVSB.TPVScrollBar class and fixed wrong scrolling under Windows.
  • Modified: Enabled Windows XP manifest to have themed scrollbars.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Integrated.lpi

    r72 r89  
    1515      <UseAppBundle Value="False"/>
    1616      <ResourceType Value="res"/>
     17      <UseXPManifest Value="True"/>
    1718      <Icon Value="0"/>
    1819    </General>
     
    450451        <StackChecks Value="True"/>
    451452      </Checks>
     453      <VerifyObjMethodCallValidity Value="True"/>
    452454    </CodeGeneration>
    453455    <Linking>
  • trunk/LocalPlayer/Help.pas

    r73 r89  
    205205  SearchResult := THyperText.Create;
    206206  SearchResult.OwnsObjects := True;
    207   sb := TPVScrollbar.Create;
    208   sb.Setup(36, 9, 11, Self);
     207  sb := TPVScrollbar.Create(Self);
     208  sb.SetBorderSpacing(36, 9, 11);
    209209  sb.OnUpdate := ScrollBarUpdate;
    210210
     
    268268procedure THelpDlg.OnScroll(var m: TMessage);
    269269begin
     270  { TODO: Handled by MouseWheel event
    270271  if sb.Process(m) then begin
    271272    Sel := -1;
    272273    SmartUpdateContent(true)
    273   end
     274  end;
     275  }
    274276end;
    275277
     
    294296  s: string;
    295297begin
    296   s := MainText[sb.si.npos + i];
     298  s := MainText[sb.Position + i];
    297299  if s = '' then
    298300    exit;
     
    304306    y := y + WideFrame
    305307  end;
    306   if THelpLineInfo(MainText.Objects[sb.si.npos + i]).Format
     308  if THelpLineInfo(MainText.Objects[sb.Position + i]).Format
    307309    in [pkCaption, pkBigTer, pkRightIcon, pkBigFeature] then
    308310  begin
     
    320322    ca.Font.Assign(UniFont[ftNormal]);
    321323  end
    322   else if THelpLineInfo(MainText.Objects[sb.si.npos + i]).Format = pkSection
     324  else if THelpLineInfo(MainText.Objects[sb.Position + i]).Format = pkSection
    323325  then
    324326  begin
     
    339341        TextSize.cy := WideFrame + InnerHeight - y;
    340342      FillSeamless(ca, x, y, TextSize.cx, TextSize.cy, -SideFrame,
    341         sb.si.npos * 24 - WideFrame, Paper);
     343        sb.Position * 24 - WideFrame, Paper);
    342344    end;
    343345    BiColorTextOut(ca, TextColor, $7F007F, x, y, s);
     
    441443  CaptionColor := Colors.Canvas.Pixels[clkMisc, cliPaperCaption];
    442444  FillSeamless(OffScreen.Canvas, 0, 0, InnerWidth, InnerHeight, 0,
    443     sb.si.npos * 24, Paper);
     445    sb.Position * 24, Paper);
    444446  with OffScreen.Canvas do
    445447  begin
    446448    Font.Assign(UniFont[ftNormal]);
    447     for i := -sb.si.npos to InnerHeight div 24 do
    448       if sb.si.npos + i < MainText.Count then
     449    for i := -sb.Position to InnerHeight div 24 do
     450      if sb.Position + i < MainText.Count then
    449451      begin
    450         HelpLineInfo := THelpLineInfo(MainText.Objects[sb.si.npos + i]);
     452        HelpLineInfo := THelpLineInfo(MainText.Objects[sb.Position + i]);
    451453        if HelpLineInfo.Format = pkExternal then
    452454        begin
     
    459461      end;
    460462    for i := -2 to InnerHeight div 24 do
    461       if (sb.si.npos + i >= 0) and (sb.si.npos + i < MainText.Count) then
     463      if (sb.Position + i >= 0) and (sb.Position + i < MainText.Count) then
    462464      begin
    463         HelpLineInfo := THelpLineInfo(MainText.Objects[sb.si.npos + i]);
     465        HelpLineInfo := THelpLineInfo(MainText.Objects[sb.Position + i]);
    464466        if HelpLineInfo.Link <> 0 then
    465467        begin
     
    18701872      HistKind[nHist - 1] := Kind;
    18711873      HistNo[nHist - 1] := no;
    1872       HistPos[nHist - 1] := sb.si.npos;
     1874      HistPos[nHist - 1] := sb.Position;
    18731875      HistSearchContent[nHist - 1] := SearchContent
    18741876    end
     
    18881890begin
    18891891  y := y - WideFrame;
    1890   i0 := sb.si.npos;
     1892  i0 := sb.Position;
    18911893  Sel0 := Sel;
    18921894  if (x >= SideFrame) and (x < SideFrame + InnerWidth) and (y >= 0) and
     
    19111913begin
    19121914  if Sel >= 0 then
    1913     with THelpLineInfo(MainText.Objects[Sel + sb.si.npos]) do
     1915    with THelpLineInfo(MainText.Objects[Sel + sb.Position]) do
    19141916      if Link shr 8 and $3F = hkInternet then
    19151917        case Link and $FF of
  • trunk/LocalPlayer/PVSB.pas

    r70 r89  
    1818  private
    1919    FOnUpdate: TNotifyEvent;
     20    ScrollBar: TScrollBar;
     21    function GetMax: Integer;
     22    function GetPageSize: Integer;
     23    function GetPosition: Integer;
    2024    procedure ScrollBarChanged(Sender: TObject);
     25    procedure SetMax(AValue: Integer);
     26    procedure SetPageSize(AValue: Integer);
     27    procedure SetPosition(AValue: Integer);
    2128  public
    22     ScrollBar: TScrollBar;
    23     si: TScrollInfo;
     29    constructor Create(Parent: TWinControl);
    2430    destructor Destroy; override;
    25     procedure Setup(TopSpacing, RightSpacing, BottomSpacing: integer; Parent: TWinControl);
    26     procedure Init(max, Page: integer);
     31    procedure Init(Max, Page: Integer);
    2732    procedure SetPos(Pos: Integer);
    2833    function Process(const m: TMessage): boolean;
    29     function ProcessMouseWheel(Delta: Integer) : boolean;
     34    function ProcessMouseWheel(Delta: Integer): Boolean;
    3035    procedure Show(Visible: boolean);
    3136    procedure EndSB;
    32     procedure UpdateScrollBar;
     37    procedure SetBorderSpacing(Top, Right, Bottom: Integer);
    3338    property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate;
     39    property Position: Integer read GetPosition write SetPosition;
     40    property Max: Integer read GetMax write SetMax;
     41    property PageSize: Integer read GetPageSize write SetPageSize;
    3442  end;
    3543
     
    3846
    3947const
    40   Count: integer = 0;
     48  Count: Integer = 0;
    4149
    42 procedure TPVScrollBar.Setup(TopSpacing, RightSpacing, BottomSpacing: integer;
    43   Parent: TWinControl);
     50procedure TPVScrollBar.Init(Max, Page: Integer);
    4451begin
    45   inc(Count);
    46   //{$IFDEF LINUX}
    47 //  sb.Form := TForm.Create(nil);
    48 //  sb.Form.SetBounds(x1 - 100, y0, 100, y1 - y0);
    49 //  sb.Form.Name := 'PVSB' + IntToStr(Count);
    50   ScrollBar := TScrollBar.Create(Parent);
    51   ScrollBar.Kind := sbVertical;
    52   ScrollBar.Name := 'PVSB' + IntToStr(Count);
    53   ScrollBar.Parent := Parent;
    54   ScrollBar.BorderSpacing.Top := TopSpacing;
    55   ScrollBar.BorderSpacing.Right := RightSpacing;
    56   ScrollBar.BorderSpacing.Bottom := BottomSpacing;
    57   ScrollBar.Align := alRight;
    58   ScrollBar.OnChange := ScrollBarChanged;
    59   //sb.h := sb.ScrollBar.Handle;
    60   (*
    61   {$ENDIF}
    62   {$IFDEF WINDOWS}
    63   sb.h := CreateWindowEx(0, 'SCROLLBAR', pchar('PVSB' + IntToStr(Count)),
    64     SBS_VERT or WS_CHILD or SBS_RIGHTALIGN, x1 - 100, y0, 100, y1 - y0,
    65     Handle, 0, 0, nil);
    66   {$ENDIF}
    67   *)
    68   si.cbSize := 28;
    69 end;
    70 
    71 procedure TPVScrollBar.Init(max, Page: integer);
    72 begin
    73   with si do begin
    74     nMin := 0;
    75     nMax := max;
    76     npos := 0;
    77     nPage := Page;
    78     FMask := SIF_PAGE or SIF_POS or SIF_RANGE;
    79   end;
    80   UpdateScrollBar;
    81   //SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    82   if max < Page then ScrollBar.Visible := False
    83     else ScrollBar.Visible := True;
     52  ScrollBar.Min := 0;
     53  ScrollBar.Max := Max;
     54  ScrollBar.PageSize := Page;
     55  ScrollBar.Position := 0;
     56  ScrollBar.Visible := ScrollBar.Max >= ScrollBar.PageSize;
    8457end;
    8558
     
    8760begin
    8861  if Pos <> 0 then begin
    89     si.npos := Pos;
    90     si.FMask := SIF_POS;
    91     //SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    92     UpdateScrollBar;
     62    ScrollBar.Position := Pos;
    9363  end;
    9464end;
     
    9868  NewPos: integer;
    9969begin
    100   with si do
    101     if nMax < integer(nPage) then
     70    if ScrollBar.Max < ScrollBar.PageSize then
    10271      result := false
    10372    else
     
    10574      if (m.wParam and $ffff) in [SB_THUMBPOSITION, SB_THUMBTRACK] then
    10675      begin
    107         result := ((m.wParam shr 16) and $ffff) <> npos;
    108         npos := (m.wParam shr 16) and $ffff;
    109       end
    110       else
    111       begin
     76        result := ((m.wParam shr 16) and $ffff) <> ScrollBar.Position;
     77        ScrollBar.Position := (m.wParam shr 16) and $ffff;
     78      end else begin
    11279        case (m.wParam and $ffff) of
    11380          SB_LINEUP:
    114             NewPos := npos - 1;
     81            NewPos := ScrollBar.Position - 1;
    11582          SB_LINEDOWN:
    116             NewPos := npos + 1;
     83            NewPos := ScrollBar.Position + 1;
    11784          SB_PAGEUP:
    118             NewPos := npos - integer(nPage);
     85            NewPos := ScrollBar.Position - ScrollBar.PageSize;
    11986          SB_PAGEDOWN:
    120             NewPos := npos + integer(nPage);
     87            NewPos := ScrollBar.Position + ScrollBar.PageSize;
    12188        else
    122           NewPos := npos
     89          NewPos := ScrollBar.Position
    12390        end;
    12491        if NewPos < 0 then
    12592          NewPos := 0;
    126         if NewPos > nMax - integer(nPage) + 1 then
    127           NewPos := nMax - integer(nPage) + 1;
    128         result := NewPos <> npos;
    129         if (NewPos <> npos) or ((m.wParam and $ffff) = SB_ENDSCROLL) then
     93        if NewPos > ScrollBar.Max - ScrollBar.PageSize + 1 then
     94          NewPos := ScrollBar.Max - ScrollBar.PageSize + 1;
     95        result := NewPos <> ScrollBar.Position;
     96        if (NewPos <> ScrollBar.Position) or ((m.wParam and $ffff) = SB_ENDSCROLL) then
    13097        begin
    131           npos := NewPos;
    132           FMask := SIF_POS;
    133           UpdateScrollBar;
    134           //SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
     98          ScrollBar.Position := NewPos;
    13599        end;
    136       end
    137     end
     100      end;
     101    end;
    138102end;
    139103
    140 function TPVScrollBar.ProcessMouseWheel(Delta: Integer
    141   ): boolean;
     104function TPVScrollBar.ProcessMouseWheel(Delta: Integer): Boolean;
    142105var
    143106  NewPos: integer;
    144107begin
    145   with si do
    146     if nMax < integer(nPage) then
    147       result := false
    148     else
    149     begin
    150       NewPos := npos - Delta div 300;
    151       if NewPos < 0 then
    152         NewPos := 0;
    153       if NewPos > nMax - integer(nPage) + 1 then
    154         NewPos := nMax - integer(nPage) + 1;
    155       result := NewPos <> npos;
    156       if NewPos <> npos then
    157       begin
    158         npos := NewPos;
    159         FMask := SIF_POS;
    160         UpdateScrollBar;
    161         //SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    162       end
    163     end
     108    if ScrollBar.Max < ScrollBar.PageSize then Result := False
     109    else begin
     110      NewPos := ScrollBar.Position - Delta div 300;
     111      if NewPos < 0 then NewPos := 0;
     112      if NewPos > ScrollBar.Max - ScrollBar.PageSize + 1 then
     113        NewPos := ScrollBar.Max - ScrollBar.PageSize + 1;
     114      Result := NewPos <> ScrollBar.Position;
     115      if NewPos <> ScrollBar.Position then begin
     116        ScrollBar.Position := NewPos;
     117      end;
     118    end;
    164119end;
    165120
    166121procedure TPVScrollBar.Show(Visible: boolean);
    167122begin
    168   if not Visible or (si.nMax < integer(si.nPage)) then
     123  if not Visible or (ScrollBar.Max < ScrollBar.PageSize) then
    169124    ScrollBar.Visible := False
    170125    else ScrollBar.Visible := True;
     
    173128procedure TPVScrollBar.EndSB;
    174129begin
    175   with si do begin
    176     if nMax < integer(nPage) then
    177       npos := 0 // hidden
    178     else begin
    179       si.npos := nMax - integer(nPage) + 1;
    180       si.FMask := SIF_POS;
    181       UpdateScrollBar;
    182       //SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    183     end
    184   end
     130  if ScrollBar.Max < ScrollBar.PageSize then
     131    ScrollBar.Position := 0 // hidden
     132  else begin
     133    ScrollBar.Position := ScrollBar.Max - ScrollBar.PageSize + 1;
     134  end;
    185135end;
    186136
    187 procedure TPVScrollBar.UpdateScrollBar;
     137procedure TPVScrollBar.SetBorderSpacing(Top, Right, Bottom: Integer);
    188138begin
    189   ScrollBar.Min := si.nMin;
    190   ScrollBar.Max := Max(si.nMax{$IFDEF LINUX} - si.nPage + 1{$ENDIF}, 0);
    191   ScrollBar.PageSize := si.nPage;
    192   ScrollBar.Position := si.nPos;
     139  ScrollBar.BorderSpacing.Top := Top;
     140  ScrollBar.BorderSpacing.Right := Right;
     141  ScrollBar.BorderSpacing.Bottom := Bottom;
    193142end;
    194143
     
    197146procedure TPVScrollBar.ScrollBarChanged(Sender: TObject);
    198147begin
    199   si.npos := ScrollBar.Position;
    200148  if Assigned(FOnUpdate) then FOnUpdate(Self);
     149end;
     150
     151procedure TPVScrollBar.SetMax(AValue: Integer);
     152begin
     153  ScrollBar.Max := AValue;
     154end;
     155
     156procedure TPVScrollBar.SetPageSize(AValue: Integer);
     157begin
     158  ScrollBar.PageSize := AValue;
     159end;
     160
     161function TPVScrollBar.GetPosition: Integer;
     162begin
     163  Result := ScrollBar.Position;
     164end;
     165
     166function TPVScrollBar.GetMax: Integer;
     167begin
     168  Result := ScrollBar.Max;
     169end;
     170
     171function TPVScrollBar.GetPageSize: Integer;
     172begin
     173  Result := ScrollBar.PageSize;
     174end;
     175
     176procedure TPVScrollBar.SetPosition(AValue: Integer);
     177begin
     178  ScrollBar.Position := AValue;
     179end;
     180
     181constructor TPVScrollBar.Create(Parent: TWinControl);
     182begin
     183  Inc(Count);
     184  ScrollBar := TScrollBar.Create(Parent);
     185  ScrollBar.Kind := sbVertical;
     186  ScrollBar.Name := 'PVSB' + IntToStr(Count);
     187  ScrollBar.Align := alRight;
     188  ScrollBar.OnChange := ScrollBarChanged;
     189  ScrollBar.Parent := Parent;
    201190end;
    202191
    203192destructor TPVScrollBar.Destroy;
    204193begin
    205   //h := 0;
    206   si.cbSize := 0;
    207194  FreeAndNil(ScrollBar);
    208195end;
  • trunk/LocalPlayer/Select.pas

    r71 r89  
    102102  inherited;
    103103  Canvas.Font.Assign(UniFont[ftNormal]);
    104   sb := TPVScrollbar.Create;
    105   sb.Setup(36, 10, 36, Self);
     104  sb := TPVScrollbar.Create(Self);
     105  sb.SetBorderSpacing(36, 10, 36);
    106106  sb.OnUpdate := ScrollBarUpdate;
    107107  InitButtons();
     
    135135procedure TListDlg.OnScroll(var m: TMessage);
    136136begin
     137  { TODO: Handled by MouseWheel event
    137138  if sb.Process(m) then  begin
    138139    Sel := -2;
    139140    SmartUpdateContent(true);
    140141  end;
     142  }
    141143end;
    142144
     
    234236  CanGrow: boolean;
    235237begin
    236   lix := code[Layer, sb.si.npos + l];
     238  lix := code[Layer, sb.Position + l];
    237239  y0 := 2 + (l + 1) * LineDistance;
    238   if sb.si.npos + l >= FirstShrinkedLine[Layer] then
    239     ofs := (sb.si.npos + l - FirstShrinkedLine[Layer]) and 1 * 33
     240  if sb.Position + l >= FirstShrinkedLine[Layer] then
     241    ofs := (sb.Position + l - FirstShrinkedLine[Layer]) and 1 * 33
    240242  else { if FirstShrinkedLine[Layer]<Lines[Layer] then }
    241243    ofs := 33;
     
    468470          begin
    469471            s := Tribe[mox.Owner].ModelName[mox.mix];
    470             if (Kind = kAllEModels) and (code[1, sb.si.npos + l] = 0) then
     472            if (Kind = kAllEModels) and (code[1, sb.Position + l] = 0) then
    471473              s := Format(Tribe[mox.Owner].TPhrase('OWNED'), [s]);
    472474          end
     
    753755      end;
    754756    for i := -1 to DispLines do
    755       if (i + sb.si.npos >= 0) and (i + sb.si.npos < Lines[Layer]) then
     757      if (i + sb.Position >= 0) and (i + sb.Position < Lines[Layer]) then
    756758        Self.line(offscreen.Canvas, i, true, false)
    757759  end;
     
    766768begin
    767769  y := y - TitleHeight;
    768   i0 := sb.si.npos;
     770  i0 := sb.Position;
    769771  Sel0 := Sel;
    770772  if (x >= SideFrame) and (x < SideFrame + InnerWidth) and (y >= 0) and
     
    891893  lix: integer;
    892894begin
    893   if sb.si.npos + Sel >= 0 then
    894     lix := code[Layer, sb.si.npos + Sel];
     895  if sb.Position + Sel >= 0 then
     896    lix := code[Layer, sb.Position + Sel];
    895897  if Kind in [kScience, kCities, kCityEvents, kModels, kEModels, kAllEModels]
    896898  then
     
    920922        kEModels:
    921923          UnitStatDlg.ShowNewContent_EnemyModel(FWindowMode or wmPersistent,
    922             code[1, sb.si.npos + Sel]);
     924            code[1, sb.Position + Sel]);
    923925        kAllEModels, kChooseEModel:
    924926          if lix <> mixAll then
     
    15991601  CaptionLeft := ToggleBtn.Left + ToggleBtn.Width;
    16001602  CaptionRight := CloseBtn.Left;
     1603  { TODO:
    16011604  SetWindowPos(sb.ScrollBar.Handle, 0, SideFrame + InnerWidth - GetSystemMetrics(SM_CXVSCROLL),
    16021605    TitleHeight, GetSystemMetrics(SM_CXVSCROLL), LineDistance * DispLines + 48,
    16031606    SWP_NOZORDER or SWP_NOREDRAW);
     1607  }
    16041608
    16051609  if WindowMode = wmModal then
  • trunk/LocalPlayer/Term.pas

    r88 r89  
    14741474    StayOnTop_Ensured := false;
    14751475
    1476     sb.Setup(0, 0, 0, Self);
     1476    sb := TPVScrollbar.Create(Self);
    14771477    sb.OnUpdate := ScrollBarUpdate;
    14781478  end; { InitModule }
     
    34353435    SoundMode := smOn;
    34363436
    3437   sb := TPVScrollbar.Create;
    34383437{$IFDEF WINDOWS}{ TODO }
    34393438  Screen.Cursors[crImpDrag] := LoadCursor(HInstance, 'DRAG');
     
    35763575  EOT.Top := ClientHeight - 64;
    35773576  EOT.Left := ClientWidth - 62;
    3578   sb.ScrollBar.BorderSpacing.Top := ClientHeight - yTroop - 24;
    3579   sb.ScrollBar.BorderSpacing.Right := ClientWidth - xRightPanel + 8;
    3580   sb.ScrollBar.BorderSpacing.Bottom := 8;
     3577  sb.SetBorderSpacing(ClientHeight - yTroop - 24, ClientWidth - xRightPanel + 8, 8);
     3578  {TODO:
    35813579  SetWindowPos(sb.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL),
    35823580    ClientHeight - MidPanelHeight + 8, 0, 0, SWP_NOSIZE or SWP_NOZORDER);
     3581    }
    35833582  MapBtn0.Left := xMini + G.lx - 44;
    35843583  MapBtn0.Top := ClientHeight - 15;
     
    44144413      for i := 0 to nBrushTypes - 1 do
    44154414      begin // display terrain types
    4416         if (Count >= TrRow * sb.si.npos) and (Count < TrRow * (sb.si.npos + 1))
     4415        if (Count >= TrRow * sb.Position) and (Count < TrRow * (sb.Position + 1))
    44174416        then
    44184417        begin
    4419           trix[Count - TrRow * sb.si.npos] := BrushTypes[i];
    4420           x := (Count - TrRow * sb.si.npos) * TrPitch;
     4418          trix[Count - TrRow * sb.Position] := BrushTypes[i];
     4419          x := (Count - TrRow * sb.Position) * TrPitch;
    44214420          xSrcBase := -1;
    44224421          case BrushTypes[i] of
     
    46464645                  if unx.Loc = TroopLoc then
    46474646                  begin
    4648                     if (Count >= TrRow * sb.si.npos) and
    4649                       (Count < TrRow * (sb.si.npos + 1)) then
     4647                    if (Count >= TrRow * sb.Position) and
     4648                      (Count < TrRow * (sb.Position + 1)) then
    46504649                    begin
    4651                       trix[Count - TrRow * sb.si.npos] := uix;
     4650                      trix[Count - TrRow * sb.Position] := uix;
    46524651                      MakeUnitInfo(me, unx, UnitInfo);
    4653                       x := (Count - TrRow * sb.si.npos) * TrPitch;
     4652                      x := (Count - TrRow * sb.Position) * TrPitch;
    46544653                      if uix = UnFocus then
    46554654                      begin
     
    47004699          Server(sGetUnits, me, TroopLoc, Count);
    47014700          for i := 0 to Count - 1 do
    4702             if (i >= TrRow * sb.si.npos) and (i < TrRow * (sb.si.npos + 1)) then
     4701            if (i >= TrRow * sb.Position) and (i < TrRow * (sb.Position + 1)) then
    47034702            begin // display enemy units
    4704               trix[i - TrRow * sb.si.npos] := i;
    4705               x := (i - TrRow * sb.si.npos) * TrPitch;
     4703              trix[i - TrRow * sb.Position] := i;
     4704              x := (i - TrRow * sb.Position) * TrPitch;
    47064705              NoMap.SetOutput(Panel);
    47074706              NoMap.PaintUnit(xTroop + 2 + x, yTroop + 1,
     
    63486347  begin
    63496348    sb.Init((TrCnt + TrRow - 1) div TrRow - 1, 1);
    6350     with sb.si do
    6351       if (nMax >= integer(nPage)) and (trixFocus >= 0) then
    6352       begin
    6353         sb.si.npos := trixFocus div TrRow;
    6354         sb.si.FMask := SIF_POS;
    6355         SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    6356       end
    6357   end
     6349    if (sb.Max >= sb.PageSize) and (trixFocus >= 0) then
     6350      sb.Position := trixFocus div TrRow;
     6351  end;
    63586352end;
    63596353
Note: See TracChangeset for help on using the changeset viewer.