unit antvis;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TFormaAnteriorVista = class(TForm)
    Panel1: TPanel;
    Bevel2: TBevel;
    Bevel3: TBevel;
    Bevel4: TBevel;
    Label4: TLabel;
    Panel2: TPanel;
    Label1: TLabel;
    procedure Panel2Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Panel1Click(Sender: TObject);
    procedure Label4MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Label4Click(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormaAnteriorVista: TFormaAnteriorVista;

implementation

uses Lista;

{$R *.DFM}

procedure actualizacoordenadas;
begin
with FormaAnteriorVista do
begin
FormaDisenoVista.Top:=FormaAnteriorVista.Top+26;
FormaDisenoVista.Left:=FormaAnteriorVista.Left+3;
FormaDisenoVista.Width:=FormaAnteriorVista.Width-6;
FormaDisenoVista.Height:=FormaAnteriorVista.Height-Panel1.Height-10;
end;
end;

procedure ponecoordenadas;
begin
with FormaAnteriorVista do
begin
FormaDisenoVista.Top:=FormaAnteriorVista.Top+26;
FormaDisenoVista.Left:=FormaAnteriorVista.Left+3;
end;
end;

procedure poneforma;
begin
with FormaAnteriorVista do
begin
ponecoordenadas;
FormaDisenoVista.Visible:=True;
FormaDisenoVista.Show;
Tag:=Tag+1; if tag>3 then Tag:=3;
end;
end;

{******************************}

procedure TFormaAnteriorVista.Panel2Click(Sender: TObject);
begin
{******panel que simula el boton cerrar*****}
Tag:=0;
FormaDisenoVista.Close;
Close;
{************************************}
end;

procedure TFormaAnteriorVista.FormActivate(Sender: TObject);
begin
{*******va en Activa*******}
if Tag<1 then
begin
actualizacoordenadas;
poneforma;
end;
end;

procedure TFormaAnteriorVista.Panel1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
{*******va en el Click del panel*******}
FormaDisenoVista.Visible:=False;
ReleaseCapture;
SendMessage(FormaAnteriorVista.Handle, WM_SYSCOMMAND, $F012, 0);
poneforma;
{**********************}
end;

procedure TFormaAnteriorVista.Panel1Click(Sender: TObject);
begin
poneforma;
end;

procedure TFormaAnteriorVista.Label4MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FormaDisenoVista.Visible:=False;
ReleaseCapture;
SendMessage(FormaAnteriorVista.Handle, WM_SYSCOMMAND, $F012, 0);
poneforma;
end;

procedure TFormaAnteriorVista.Label4Click(Sender: TObject);
begin
poneforma;
end;

procedure TFormaAnteriorVista.FormPaint(Sender: TObject);
begin
if FormaDisenoVista.BotonSalir.Tag=1000 then
begin
Close;
Tag:=0;
FormaDisenoVista.BotonSalir.Tag:=0;
end;
end;


procedure TFormaAnteriorVista.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
FormaDisenoVista.BotonSalir.Tag:=0;
Tag:=0;
end;

end.
