Changeset 69 for trunk


Ignore:
Timestamp:
Jan 14, 2017, 10:33:42 PM (8 years ago)
Author:
chronos
Message:
  • Fixed: Implemented platform independent scrollbars usage. Tested on Linux.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Integrated.lpi

    r67 r69  
    301301        <Filename Value="LocalPlayer\Help.pas"/>
    302302        <IsPartOfProject Value="True"/>
    303         <HasResources Value="True"/>
     303        <ComponentName Value="HelpDlg"/>
     304        <HasResources Value="True"/>
     305        <ResourceBaseClass Value="Form"/>
    304306      </Unit25>
    305307      <Unit26>
    306308        <Filename Value="LocalPlayer\Select.pas"/>
    307309        <IsPartOfProject Value="True"/>
    308         <HasResources Value="True"/>
     310        <ComponentName Value="ListDlg"/>
     311        <HasResources Value="True"/>
     312        <ResourceBaseClass Value="Form"/>
    309313      </Unit26>
    310314      <Unit27>
     
    414418        <IsPartOfProject Value="True"/>
    415419        <ComponentName Value="LocaleDlg"/>
     420        <HasResources Value="True"/>
    416421        <ResourceBaseClass Value="Form"/>
    417422      </Unit43>
  • trunk/LocalPlayer/Help.lfm

    r9 r69  
    1717  OnDestroy = FormDestroy
    1818  OnKeyDown = FormKeyDown
     19  OnMouseWheel = FormMouseWheel
    1920  OnMouseDown = PaintBox1MouseDown
    2021  OnMouseMove = PaintBox1MouseMove
  • trunk/LocalPlayer/Help.pas

    r68 r69  
    4747  end;
    4848
     49  { THelpDlg }
     50
    4951  THelpDlg = class(TFramedDlg)
    5052    CloseBtn: TButtonB;
     
    5456    procedure FormCreate(Sender: TObject);
    5557    procedure FormDestroy(Sender: TObject);
     58    procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
     59      WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
    5660    procedure FormPaint(Sender: TObject);
    5761    procedure CloseBtnClick(Sender: TObject);
     
    6569    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    6670    procedure SearchBtnClick(Sender: TObject);
    67   public
    68     Difficulty: integer;
    69     procedure ShowNewContent(NewMode, Category, Index: integer);
    70     procedure ClearHistory;
    71     function TextIndex(Item: string): integer;
    7271  protected
    7372    procedure OffscreenPaint; override;
     
    8786    HistPos: array [0 .. MaxHist - 1] of integer;
    8887    HistSearchContent: array [0 .. MaxHist - 1] of shortstring;
     88    procedure ScrollBarUpdate(Sender: TObject);
    8989    procedure line(ca: TCanvas; i: integer; lit: boolean);
    9090    procedure Prepare(sbPos: integer = 0);
     
    9292    procedure Search(SearchString: string);
    9393    procedure OnScroll(var m: TMessage); message WM_VSCROLL;
    94     procedure OnMouseWheel(var m: TMessage); message LM_MOUSEWHEEL;
    9594    procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
     95  public
     96    Difficulty: integer;
     97    procedure ShowNewContent(NewMode, Category, Index: integer);
     98    procedure ClearHistory;
     99    function TextIndex(Item: string): integer;
    96100  end;
    97101
     
    202206  SearchResult.OwnsObjects := True;
    203207  sb := TPVScrollbar.Create;
    204   CreatePVSB(sb, Handle, 36, 551, 36 + 432);
     208  sb.Setup(36, 9, 11, Self);
     209  sb.OnUpdate := ScrollBarUpdate;
    205210
    206211  HelpText := TStringTable.Create;
     
    247252end;
    248253
     254procedure THelpDlg.FormMouseWheel(Sender: TObject; Shift: TShiftState;
     255  WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
     256begin
     257  if sb.ProcessMouseWheel(WheelDelta) then begin
     258    PaintBox1MouseMove(nil, [], MousePos.X - Left,
     259      MousePos.Y - Top);
     260  end;
     261end;
     262
    249263procedure THelpDlg.CloseBtnClick(Sender: TObject);
    250264begin
    251   Close
     265  Close;
    252266end;
    253267
    254268procedure THelpDlg.OnScroll(var m: TMessage);
    255269begin
    256   if ProcessPVSB(sb, m) then
    257   begin
     270  if sb.Process(m) then begin
    258271    Sel := -1;
    259272    SmartUpdateContent(true)
     
    261274end;
    262275
    263 procedure THelpDlg.OnMouseWheel(var m: TMessage);
    264 begin
    265   if ProcessMouseWheel(sb, m) then
    266   begin
    267     Sel := -1;
    268     SmartUpdateContent(true);
    269     PaintBox1MouseMove(nil, [], m.lParam and $FFFF - Left,
    270       m.lParam shr 16 - Top);
    271   end
    272 end;
    273 
    274276procedure THelpDlg.OnMouseLeave(var Msg: TMessage);
    275277begin
    276   if Sel <> -1 then
    277   begin
     278  if Sel <> -1 then begin
    278279    line(Canvas, Sel, false);
    279280    Sel := -1
     
    771772  MarkUsedOffscreen(InnerWidth, InnerHeight + 13 + 48);
    772773end; { OffscreenPaint }
     774
     775procedure THelpDlg.ScrollBarUpdate(Sender: TObject);
     776begin
     777  Sel := -1;
     778  SmartUpdateContent(true)
     779end;
    773780
    774781procedure THelpDlg.Prepare(sbPos: integer = 0);
     
    18351842      LF;
    18361843
    1837     InitPVSB(sb, Count - 1, InnerHeight div 24);
    1838     if sbPos <> 0 then
    1839     begin
    1840       sb.si.npos := sbPos;
    1841       sb.si.FMask := SIF_POS;
    1842       SetScrollInfo(sb.h, SB_CTL, sb.si, true);
    1843     end;
     1844    //Self.Show;
     1845    sb.Init(Count - 1, InnerHeight div 24);
     1846    sb.SetPos(sbPos);
    18441847    BackBtn.Visible := nHist > 0;
    18451848    TopBtn.Visible := (nHist > 0) or (Kind <> hkMisc) or (no <> miscMain);
  • trunk/LocalPlayer/PVSB.pas

    r50 r69  
    88  Windows,
    99  {$ENDIF}
    10   Forms, LCLIntf, LCLType, LMessages, Messages, SysUtils;
     10  Classes, Controls, Forms, LCLIntf, LCLType, LMessages, Messages, SysUtils,
     11  StdCtrls, Math;
    1112
    1213type
     
    1415  { TPVScrollbar }
    1516
    16   TPVScrollbar = class
    17     h: integer;
     17  TPVScrollBar = class
     18  private
     19    FOnUpdate: TNotifyEvent;
     20    procedure ScrollBarChanged(Sender: TObject);
     21  public
     22    ScrollBar: TScrollBar;
    1823    si: TScrollInfo;
    19     Form: TForm;
    2024    destructor Destroy; override;
     25    procedure Setup(TopSpacing, RightSpacing, BottomSpacing: integer; Parent: TWinControl);
     26    procedure Init(max, Page: integer);
     27    procedure SetPos(Pos: Integer);
     28    function Process(const m: TMessage): boolean;
     29    function ProcessMouseWheel(Delta: Integer) : boolean;
     30    procedure Show(Visible: boolean);
     31    procedure EndSB;
     32    procedure UpdateScrollBar;
     33    property OnUpdate: TNotifyEvent read FOnUpdate write FOnUpdate;
    2134  end;
    2235
    23   procedure CreatePVSB(var sb: TPVScrollbar; Handle, y0, x1, y1: integer);
    24   procedure InitPVSB(var sb: TPVScrollbar; max, Page: integer);
    25   function ProcessPVSB(var sb: TPVScrollbar; const m: TMessage): boolean;
    26   function ProcessMouseWheel(var sb: TPVScrollbar; const m: TMessage)
    27     : boolean;
    28   procedure ShowPVSB(var sb: TPVScrollbar; Visible: boolean);
    29   procedure EndPVSB(var sb: TPVScrollbar);
    3036
    3137implementation
     
    3440  Count: integer = 0;
    3541
    36 procedure CreatePVSB(var sb: TPVScrollbar; Handle, y0, x1, y1: integer);
     42procedure TPVScrollBar.Setup(TopSpacing, RightSpacing, BottomSpacing: integer;
     43  Parent: TWinControl);
    3744begin
    3845  inc(Count);
    39   {$IFDEF LINUX}
    40   sb.Form := TForm.Create(nil);
    41   sb.Form.SetBounds(x1 - 100, y0, 100, y1 - y0);
    42   sb.Form.Name := 'PVSB' + IntToStr(Count);
    43   sb.h := sb.Form.Handle;
     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  (*
    4461  {$ENDIF}
    4562  {$IFDEF WINDOWS}
     
    4865    Handle, 0, 0, nil);
    4966  {$ENDIF}
    50   sb.si.cbSize := 28;
    51 end;
    52 
    53 procedure InitPVSB(var sb: TPVScrollbar; max, Page: integer);
    54 begin
    55   with sb.si do
    56   begin
     67  *)
     68  si.cbSize := 28;
     69end;
     70
     71procedure TPVScrollBar.Init(max, Page: integer);
     72begin
     73  with si do begin
    5774    nMin := 0;
    5875    nMax := max;
     
    6178    FMask := SIF_PAGE or SIF_POS or SIF_RANGE;
    6279  end;
    63   SetScrollInfo(sb.h, SB_CTL, sb.si, true);
    64   if max < Page then
    65     ShowWindow(sb.h, SW_HIDE)
    66   else
    67     ShowWindow(sb.h, SW_SHOW)
    68 end;
    69 
    70 function ProcessPVSB(var sb: TPVScrollbar; const m: TMessage): Boolean;
     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;
     84end;
     85
     86procedure TPVScrollBar.SetPos(Pos: Integer);
     87begin
     88  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;
     93  end;
     94end;
     95
     96function TPVScrollBar.Process(const m: TMessage): boolean;
    7197var
    7298  NewPos: integer;
    7399begin
    74   with sb.si do
     100  with si do
    75101    if nMax < integer(nPage) then
    76102      result := false
     
    105131          npos := NewPos;
    106132          FMask := SIF_POS;
    107           SetScrollInfo(sb.h, SB_CTL, sb.si, true);
     133          UpdateScrollBar;
     134          //SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    108135        end;
    109136      end
     
    111138end;
    112139
    113 function ProcessMouseWheel(var sb: TPVScrollbar; const m: TMessage): Boolean;
     140function TPVScrollBar.ProcessMouseWheel(Delta: Integer
     141  ): boolean;
    114142var
    115143  NewPos: integer;
    116144begin
    117   with sb.si do
     145  with si do
    118146    if nMax < integer(nPage) then
    119147      result := false
    120148    else
    121149    begin
    122       NewPos := npos - m.wParam div (1 shl 16 * 40);
     150      NewPos := npos - Delta div 300;
    123151      if NewPos < 0 then
    124152        NewPos := 0;
     
    130158        npos := NewPos;
    131159        FMask := SIF_POS;
    132         SetScrollInfo(sb.h, SB_CTL, sb.si, true);
     160        UpdateScrollBar;
     161        //SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    133162      end
    134163    end
    135164end;
    136165
    137 procedure ShowPVSB(var sb: TPVScrollbar; Visible: boolean);
    138 begin
    139   if not Visible or (sb.si.nMax < integer(sb.si.nPage)) then
    140     ShowWindow(sb.h, SW_HIDE)
    141   else
    142     ShowWindow(sb.h, SW_SHOW)
    143 end;
    144 
    145 procedure EndPVSB(var sb: TPVScrollbar);
    146 begin
    147   with sb.si do
    148   begin
     166procedure TPVScrollBar.Show(Visible: boolean);
     167begin
     168  if not Visible or (si.nMax < integer(si.nPage)) then
     169    ScrollBar.Visible := False
     170    else ScrollBar.Visible := True;
     171end;
     172
     173procedure TPVScrollBar.EndSB;
     174begin
     175  with si do begin
    149176    if nMax < integer(nPage) then
    150177      npos := 0 // hidden
    151     else
    152     begin
    153       sb.si.npos := nMax - integer(nPage) + 1;
    154       sb.si.FMask := SIF_POS;
    155       SetScrollInfo(sb.h, SB_CTL, sb.si, true);
     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);
    156183    end
    157184  end
    158185end;
    159186
     187procedure TPVScrollBar.UpdateScrollBar;
     188begin
     189  ScrollBar.Min := si.nMin;
     190  ScrollBar.Max := Max(si.nMax - si.nPage + 1, 0);
     191  ScrollBar.PageSize := si.nPage;
     192  ScrollBar.Position := si.nPos;
     193end;
     194
    160195{ TPVScrollbar }
    161196
    162 destructor TPVScrollbar.Destroy;
    163 begin
    164   h := 0;
     197procedure TPVScrollBar.ScrollBarChanged(Sender: TObject);
     198begin
     199  si.npos := ScrollBar.Position;
     200  if Assigned(FOnUpdate) then FOnUpdate(Self);
     201end;
     202
     203destructor TPVScrollBar.Destroy;
     204begin
     205  //h := 0;
    165206  si.cbSize := 0;
    166   FreeAndNil(Form);
     207  FreeAndNil(ScrollBar);
    167208end;
    168209
  • trunk/LocalPlayer/Select.lfm

    r9 r69  
    1717  OnDestroy = FormDestroy
    1818  OnKeyDown = FormKeyDown
     19  OnMouseWheel = FormMouseWheel
    1920  OnMouseDown = PaintBox1MouseDown
    2021  OnMouseMove = PaintBox1MouseMove
  • trunk/LocalPlayer/Select.pas

    r50 r69  
    1818    kChooseETech, kChooseModel, kChooseEModel, kChooseCity, kChooseECity,
    1919    kStealTech, kGov, kMission);
     20
     21  { TListDlg }
    2022
    2123  TListDlg = class(TFramedDlg)
     
    2628    ToggleBtn: TButtonB;
    2729    Popup: TPopupMenu;
     30    procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
     31      WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
    2832    procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState;
    2933      x, y: integer);
     
    4044    procedure PlayerClick(Sender: TObject);
    4145    procedure FormDestroy(Sender: TObject);
    42 
     46  private
     47    Kind: TListKind;
     48    LineDistance, MaxLines, cixProject, pView, Sel, DispLines, Layer, nColumn,
     49      TechNameSpace, ScienceNation: integer;
     50    sb: TPVScrollbar;
     51    Lines, FirstShrinkedLine: array [0 .. MaxLayer - 1] of integer;
     52    code: array [0 .. MaxLayer - 1, 0 .. 4095] of integer;
     53    Column: array [0 .. nPl - 1] of integer;
     54    Closable, MultiPage: boolean;
     55    ScienceNationDot: TBitmap;
     56    procedure ScrollBarUpdate(Sender: TObject);
     57    procedure InitLines;
     58    procedure line(ca: TCanvas; l: integer; NonText, lit: boolean);
     59    function RenameCity(cix: integer): boolean;
     60    function RenameModel(mix: integer): boolean;
     61    procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     62    procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
    4363  public
    4464    result: integer;
     
    5373    procedure AddCity;
    5474    procedure RemoveUnit;
    55 
    56   private
    57     Kind: TListKind;
    58     LineDistance, MaxLines, cixProject, pView, Sel, DispLines, Layer, nColumn,
    59       TechNameSpace, ScienceNation: integer;
    60     sb: TPVScrollbar;
    61     Lines, FirstShrinkedLine: array [0 .. MaxLayer - 1] of integer;
    62     code: array [0 .. MaxLayer - 1, 0 .. 4095] of integer;
    63     Column: array [0 .. nPl - 1] of integer;
    64     Closable, MultiPage: boolean;
    65     ScienceNationDot: TBitmap;
    66     procedure InitLines;
    67     procedure line(ca: TCanvas; l: integer; NonText, lit: boolean);
    68     function RenameCity(cix: integer): boolean;
    69     function RenameModel(mix: integer): boolean;
    70     procedure OnScroll(var m: TMessage); message WM_VSCROLL;
    71     procedure OnMouseWheel(var m: TMessage); message LM_MOUSEWHEEL;
    72     procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
    7375  end;
    7476
     
    101103  Canvas.Font.Assign(UniFont[ftNormal]);
    102104  sb := TPVScrollbar.Create;
    103   CreatePVSB(sb, Handle, 2, 361, 2 + 422);
     105  sb.Setup(36, 10, 36, Self);
     106  sb.OnUpdate := ScrollBarUpdate;
    104107  InitButtons();
    105108  Kind := kMission;
     
    132135procedure TListDlg.OnScroll(var m: TMessage);
    133136begin
    134   if ProcessPVSB(sb, m) then
    135   begin
     137  if sb.Process(m) then  begin
    136138    Sel := -2;
    137139    SmartUpdateContent(true);
    138   end;
    139 end;
    140 
    141 procedure TListDlg.OnMouseWheel(var m: TMessage);
    142 begin
    143   if ProcessMouseWheel(sb, m) then
    144   begin
    145     Sel := -2;
    146     SmartUpdateContent(true);
    147     PaintBox1MouseMove(nil, [], m.lParam and $FFFF - Left,
    148       m.lParam shr 16 - Top);
    149140  end;
    150141end;
     
    834825end;
    835826
     827procedure TListDlg.FormMouseWheel(Sender: TObject; Shift: TShiftState;
     828  WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
     829begin
     830  if sb.ProcessMouseWheel(WheelDelta) then begin
     831    PaintBox1MouseMove(nil, [], MousePos.X - Left,
     832      MousePos.Y - Top);
     833  end;
     834end;
     835
    836836function TListDlg.RenameCity(cix: integer): boolean;
    837837var
     
    15991599  CaptionLeft := ToggleBtn.Left + ToggleBtn.Width;
    16001600  CaptionRight := CloseBtn.Left;
    1601   SetWindowPos(sb.h, 0, SideFrame + InnerWidth - GetSystemMetrics(SM_CXVSCROLL),
     1601  SetWindowPos(sb.ScrollBar.Handle, 0, SideFrame + InnerWidth - GetSystemMetrics(SM_CXVSCROLL),
    16021602    TitleHeight, GetSystemMetrics(SM_CXVSCROLL), LineDistance * DispLines + 48,
    16031603    SWP_NOZORDER or SWP_NOREDRAW);
     
    16331633  Sel := -2;
    16341634  ScienceNation := -1;
    1635   InitPVSB(sb, Lines[Layer] - 1, DispLines);
     1635  sb.Init(Lines[Layer] - 1, DispLines);
    16361636
    16371637  OffscreenPaint;
     
    17491749  InitLines;
    17501750  Sel := -2;
    1751   InitPVSB(sb, Lines[Layer] - 1, DispLines);
     1751  sb.Init(Lines[Layer] - 1, DispLines);
    17521752  OffscreenPaint;
    17531753  Invalidate
     
    17621762
    17631763  Sel := -2;
    1764   InitPVSB(sb, Lines[Layer] - 1, DispLines);
     1764  sb.Init(Lines[Layer] - 1, DispLines);
    17651765  SmartUpdateContent
    17661766end;
     
    18631863end;
    18641864
     1865procedure TListDlg.ScrollBarUpdate(Sender: TObject);
     1866begin
     1867  Sel := -2;
     1868  SmartUpdateContent(true);
     1869end;
     1870
    18651871end.
  • trunk/LocalPlayer/Term.pas

    r67 r69  
    2222
    2323type
     24
     25  { TMainScreen }
     26
    2427  TMainScreen = class(TDrawDlg)
    2528    Timer1: TTimer;
     
    216219    procedure BareBtnDownChanged(Sender: TObject);
    217220    procedure MovieSpeedBtnClick(Sender: TObject);
    218 
    219   public
    220     procedure CreateParams(var p: TCreateParams); override;
    221     procedure Client(Command, NewPlayer: integer; var Data);
    222     procedure SetAIName(p: integer; Name: string);
    223     function ZoomToCity(Loc: integer; NextUnitOnClose: boolean = false;
    224       ShowEvent: integer = 0): boolean;
    225     procedure CityClosed(Activateuix: integer; StepFocus: boolean = false;
    226       SelectFocus: boolean = false);
    227     function DipCall(Command: integer): integer;
    228     function OfferCall(var Offer: TOffer): integer;
    229     procedure UpdateViews(UpdateCityScreen: boolean = false);
    230     function ContactRefused(p: integer; Item: String): boolean;
    231 
    232221  private
    233222    xw, yw, xwd, ywd, xwMini, ywMini, xMidPanel, xRightPanel, xTroop, xTerrain,
     
    242231    Closable, RepaintOnResize, Tracking, TurnComplete, Edited, GoOnPhase,
    243232      HaveStrategyAdvice, FirstMovieTurn: boolean;
     233    procedure ScrollBarUpdate(Sender: TObject);
    244234    procedure ArrangeMidPanel;
    245235    procedure MainOffscreenPaint;
     
    282272    procedure OnScroll(var m: TMessage); message WM_VSCROLL;
    283273    procedure OnEOT(var Msg: TMessage); message WM_EOT;
     274  public
     275    procedure CreateParams(var p: TCreateParams); override;
     276    procedure Client(Command, NewPlayer: integer; var Data);
     277    procedure SetAIName(p: integer; Name: string);
     278    function ZoomToCity(Loc: integer; NextUnitOnClose: boolean = false;
     279      ShowEvent: integer = 0): boolean;
     280    procedure CityClosed(Activateuix: integer; StepFocus: boolean = false;
     281      SelectFocus: boolean = false);
     282    function DipCall(Command: integer): integer;
     283    function OfferCall(var Offer: TOffer): integer;
     284    procedure UpdateViews(UpdateCityScreen: boolean = false);
     285    function ContactRefused(p: integer; Item: String): boolean;
    284286  end;
    285287
     
    14731475    StayOnTop_Ensured := false;
    14741476
    1475     CreatePVSB(sb, Handle, 100 - 200, 122, 100 + MidPanelHeight - 16 - 200);
     1477    sb.Setup(0, 0, 0, Self);
     1478    sb.OnUpdate := ScrollBarUpdate;
    14761479  end; { InitModule }
    14771480
     
    26562659          if Controls[i] is TButtonC then
    26572660            Controls[i].Visible := false;
    2658         InitPVSB(sb, 0, 1);
     2661        sb.Init(0, 1);
    26592662        for p1 := 0 to nPl - 1 do
    26602663          if Tribe[p1] <> nil then
     
    35773580  EOT.Top := ClientHeight - 64;
    35783581  EOT.Left := ClientWidth - 62;
    3579   SetWindowPos(sb.h, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL),
     3582  sb.ScrollBar.BorderSpacing.Top := ClientHeight - yTroop - 24;
     3583  sb.ScrollBar.BorderSpacing.Right := ClientWidth - xRightPanel + 8;
     3584  sb.ScrollBar.BorderSpacing.Bottom := 8;
     3585  SetWindowPos(sb.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL),
    35803586    ClientHeight - MidPanelHeight + 8, 0, 0, SWP_NOSIZE or SWP_NOZORDER);
    35813587  MapBtn0.Left := xMini + G.lx - 44;
     
    36153621procedure TMainScreen.OnScroll(var m: TMessage);
    36163622begin
    3617   if ProcessPVSB(sb, m) then
    3618   begin
     3623  if sb.Process(m) then begin
    36193624    PanelPaint;
    3620     Update
    3621   end
     3625    Update;
     3626  end;
    36223627end;
    36233628
     
    39623967end;
    39633968
    3964 procedure TMainScreen.PaintLocTemp(Loc, Style: integer);
     3969procedure TMainScreen.PaintLocTemp(Loc: integer; Style: integer);
    39653970var
    39663971  y0, x0, xMap, yMap: integer;
     
    63416346      Server(sGetUnits, me, Loc, TrCnt);
    63426347  if TrCnt = 0 then
    6343     InitPVSB(sb, 0, 1)
     6348    sb.Init(0, 1)
    63446349  else
    63456350  begin
    6346     InitPVSB(sb, (TrCnt + TrRow - 1) div TrRow - 1, 1);
     6351    sb.Init((TrCnt + TrRow - 1) div TrRow - 1, 1);
    63476352    with sb.si do
    63486353      if (nMax >= integer(nPage)) and (trixFocus >= 0) then
     
    63506355        sb.si.npos := trixFocus div TrRow;
    63516356        sb.si.FMask := SIF_POS;
    6352         SetScrollInfo(sb.h, SB_CTL, sb.si, true);
     6357        SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    63536358      end
    63546359  end
     
    80058010end;
    80068011
     8012procedure TMainScreen.ScrollBarUpdate(Sender: TObject);
     8013begin
     8014  PanelPaint;
     8015  Update;
     8016end;
     8017
    80078018initialization
    80088019
Note: See TracChangeset for help on using the changeset viewer.