Como variable global creo esta "CodiClient" que es una variable que arrastro de un combobox a distintos sitios dentro del mismo formulario.
Lo del auto-create forms solo tengo uno llamado "splash" lo que salta al inicio del programa , solo tengo ese.
El trozo este de codigo
Código Delphi
[-] Application.CreateForm (TfrmUnidadesPedidoVenta, frmUnidadesPedidoVenta); frmUnidadesPedidoVenta.CarregaDades(Cantidad,UnitatsServidesBD); frmUnidadesPedidoVenta.ShowModal; varDades := frmUnidadesPedidoVenta.rebreDades; varUnitatsRestants := frmUnidadesPedidoVenta.rebreUnitatsRestants; frmUnidadesPedidoVenta.Free;
Código Delphi
[-]var
frmUnidadesPedidoVenta: TfrmUnidadesPedidoVenta;
unidades_restantes : integer ;
FlagCheckSupervisado : string;
implementation
uses SupVision;
{$R *.DFM}
procedure TfrmUnidadesPedidoVenta.CarregaDades(var1,var2: integer);
begin
UnitatsPedidoVenta := var1;
UnitatsServidesBD := var2;
end;
function TfrmUnidadesPedidoVenta.rebreDades():String;
begin
Result := edit1.Text;
end;
function TfrmUnidadesPedidoVenta.rebreUnitatsRestants(): string;
begin
if (unidades_restantes = strtoint(edit1.text)) then
FlagCheckSupervisado := 'S'
else
FlagCheckSupervisado := 'N';
Result := FlagCheckSupervisado;
end;
procedure TfrmUnidadesPedidoVenta.ACTUALIZARClick(Sender: TObject);
begin
if ( strtoint(edit1.text) = 0) then
showmessage('No es posible añadir 0 unidades ')
else if ( strtoint(edit1.text) > unidades_restantes) then
showmessage('El número máximo permitido es ' + inttostr(unidades_restantes) + ' unidades ')
else
frmUnidadesPedidoVenta.Close;
end;
procedure TfrmUnidadesPedidoVenta.FormShow(Sender: TObject);
begin
label3.Caption := inttostr(UnitatsPedidoVenta);
label4.Caption := inttostr(UnitatsServidesBD);
unidades_restantes := UnitatsPedidoVenta - UnitatsServidesBD;
Label5.Caption := inttostr(unidades_restantes);
end;
procedure TfrmUnidadesPedidoVenta.edit1KeyPress(Sender: TObject;
var Key: Char);
begin
If Key = #13 then
ACTUALIZAR.Click;
end;
end.