Changeset 90 for trunk/LocalPlayer/PVSB.pas
- Timestamp:
- Jan 19, 2017, 9:04:16 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/PVSB.pas
r89 r90 19 19 FOnUpdate: TNotifyEvent; 20 20 ScrollBar: TScrollBar; 21 FMax: Integer; 21 22 function GetMax: Integer; 22 23 function GetPageSize: Integer; … … 29 30 constructor Create(Parent: TWinControl); 30 31 destructor Destroy; override; 31 procedure Init(Max, Page : Integer);32 procedure Init(Max, PageSize: Integer); 32 33 procedure SetPos(Pos: Integer); 33 34 function Process(const m: TMessage): boolean; … … 48 49 Count: Integer = 0; 49 50 50 procedure TPVScrollBar.Init(Max, Page : Integer);51 procedure TPVScrollBar.Init(Max, PageSize: Integer); 51 52 begin 53 ScrollBar.PageSize := PageSize; 52 54 ScrollBar.Min := 0; 53 ScrollBar.Max := Max; 54 ScrollBar.PageSize := Page; 55 Self.Max := Max; 55 56 ScrollBar.Position := 0; 56 ScrollBar.Visible := ScrollBar.Max >= ScrollBar.PageSize;57 ScrollBar.Visible := Max >= ScrollBar.PageSize; 57 58 end; 58 59 … … 68 69 NewPos: integer; 69 70 begin 70 if ScrollBar.Max < ScrollBar.PageSize then71 if Max < ScrollBar.PageSize then 71 72 result := false 72 73 else … … 91 92 if NewPos < 0 then 92 93 NewPos := 0; 93 if NewPos > ScrollBar.Max - ScrollBar.PageSize + 1 then94 NewPos := ScrollBar.Max - ScrollBar.PageSize + 1;94 if NewPos > Max - ScrollBar.PageSize + 1 then 95 NewPos := Max - ScrollBar.PageSize + 1; 95 96 result := NewPos <> ScrollBar.Position; 96 97 if (NewPos <> ScrollBar.Position) or ((m.wParam and $ffff) = SB_ENDSCROLL) then … … 106 107 NewPos: integer; 107 108 begin 108 if ScrollBar.Max < ScrollBar.PageSize then Result := False109 if Max < ScrollBar.PageSize then Result := False 109 110 else begin 110 111 NewPos := ScrollBar.Position - Delta div 300; 111 112 if NewPos < 0 then NewPos := 0; 112 if NewPos > ScrollBar.Max - ScrollBar.PageSize + 1 then113 NewPos := ScrollBar.Max - ScrollBar.PageSize + 1;113 if NewPos > Max - ScrollBar.PageSize + 1 then 114 NewPos := Max - ScrollBar.PageSize + 1; 114 115 Result := NewPos <> ScrollBar.Position; 115 116 if NewPos <> ScrollBar.Position then begin … … 121 122 procedure TPVScrollBar.Show(Visible: boolean); 122 123 begin 123 if not Visible or ( ScrollBar.Max < ScrollBar.PageSize) then124 if not Visible or (Max < ScrollBar.PageSize) then 124 125 ScrollBar.Visible := False 125 126 else ScrollBar.Visible := True; … … 128 129 procedure TPVScrollBar.EndSB; 129 130 begin 130 if ScrollBar.Max < ScrollBar.PageSize then131 if Max < ScrollBar.PageSize then 131 132 ScrollBar.Position := 0 // hidden 132 133 else begin 133 ScrollBar.Position := ScrollBar.Max - ScrollBar.PageSize + 1;134 ScrollBar.Position := Max - ScrollBar.PageSize + 1; 134 135 end; 135 136 end; … … 151 152 procedure TPVScrollBar.SetMax(AValue: Integer); 152 153 begin 153 ScrollBar.Max := AValue; 154 FMax := AValue; 155 ScrollBar.Max := Max{$IFDEF LINUX} - PageSize + 1{$ENDIF}; 154 156 end; 155 157 … … 166 168 function TPVScrollBar.GetMax: Integer; 167 169 begin 168 Result := ScrollBar.Max;170 Result := FMax; 169 171 end; 170 172
Note:
See TracChangeset
for help on using the changeset viewer.