From: scottmay@iccu6.ipswichcity.qld.gov.au (Scott May)
Subject: Re: [delphi] Allowing User to Resize Component
Date: Wed, 2 Aug 1995 13:18:38 +1000

Following is some code that works for vertical splits, you can make
horizontal from it:

It uses a TOutline aligned to alLeft, with desktop to the right of it. A
panel is placed after the TOutline, and also aligned alLeft. This makes it
stick to the TOutline. I call the new panel 'splitter'. Make the splitter
very narrow, bevel it if you like, and set it's cursor to east-west (or
north-south) in your case. Attach the following to the mouse events:

procedure TMainForm.SplitterMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  Resizing := True;  {global to used by mousemove}
end;

procedure TMainForm.SplitterMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Resizing := False;
end;

procedure TMainForm.SplitterMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
  if Resizing then begin
    outline.Width := outline.Width + X;
  end;
end;

scottmay@gil.ipswichcity.qld.gov.au
Smart Data Systems Pty Ltd.  61 7 3202 2075


