unit antinv;

interface

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

type
  TFormaAnteriorInventa = class(TForm)
    Shape1: TShape;
    Panel1: TPanel;
    Bevel22: TBevel;
    Bevel23: TBevel;
    Bevel24: TBevel;
    Label28: 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 Label28MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Label28Click(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormaAnteriorInventa: TFormaAnteriorInventa;

implementation

uses Inven;

{$R *.DFM}

procedure actualizacoordenadas;
begin
with FormaAnteriorInventa do
begin
FormaInventario.Top:=FormaAnteriorInventa.Top+23;
FormaInventario.Left:=FormaAnteriorInventa.Left+7;
FormaInventario.Width:=FormaAnteriorInventa.Width-14;
FormaInventario.Height:=FormaAnteriorInventa.Height-Panel1.Height-10;
end;
end;

procedure ponecoordenadas;
begin
with FormaAnteriorInventa do
begin
FormaInventario.Top:=FormaAnteriorInventa.Top+23;
FormaInventario.Left:=FormaAnteriorInventa.Left+7;
end;
end;

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

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

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

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

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

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

procedure TFormaAnteriorInventa.Label28MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FormaInventario.Visible:=False;
ReleaseCapture;
SendMessage(FormaAnteriorInventa.Handle, WM_SYSCOMMAND, $F012, 0);
poneforma;
end;

procedure TFormaAnteriorInventa.Label28Click(Sender: TObject);
begin
poneforma;
end;

Procedure TFormaAnteriorInventa.FormPaint(Sender: TObject);
begin
if FormaInventario.BotonSalir.Tag=1000 then
begin
Close;
Tag:=0;
FormaInventario.BotonSalir.Tag:=0;
end;
end;
procedure TFormaAnteriorInventa.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
FormaInventario.BotonSalir.Tag:=0;
Tag:=0;
end;

end.
