Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Arrastrar y soltar con DBGrids (https://www.clubdelphi.com/foros/showthread.php?t=19655)

NickName 21-03-2005 20:17:07

Arrastrar y soltar con DBGrids
 
Hola.

Alguien me podria ayudar y decirme como puedo seleccionar un registro de un DbGrid, y arrastralo para despues soltarlo en otro DbGrid, para que este se copie, son distintas tablas pero los campos (Origen y Destino) son del mismo tipo.... :confused:

Pablo Carlos 21-03-2005 22:55:00

Hola... como arrastrarlo no se... pero por que no usas el evento dobleclick del dbgrib y le dices que...

Código Delphi [-]
tabla2.Campox.AsString := tabla1.Campox.AsString

Saludos bye

Chaja 22-03-2005 02:20:03

Drag an Drop
 
Bueno es un poc largo pero vamos a ver:
en la grilla source no pones nada (por ahora). En la grilla Target pone en

procedure TFormAplicacionesCCCompra_2.wwDBGMovCCDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
var coord:TGridCoord;
begin
inherited;
IF Source=wwDBGActa THEN
accept:=True
ELSE
Accept:=False;
end;

y en

procedure TFormAplicacionesCCCompra_2.wwDBGMovCCDragDrop(Sender, Source: TObject; X,
Y: Integer);
begin
inherited;
IF (Moneda3D(' ',MascaraGral, wwCDSMovCCSALDO.Value))>0 Then
begin
wwCDSAplicaciones.Insert;
wwCDSAplicacionesID_MOV.Value := IBGId_AplicacionCCCompra.Increment(1);
wwCDSAplicacionesID_MOVCCCOMPRA.Value := wwCDSMovCCID_MOVCCCOMPRA.Value;
wwCDSAplicacionesAPLICA_ID_CPBTE.Value := wwCDSMovCCID_CPBTE.Value;
wwCDSAplicacionesAPLICA_TIPOCPBTE.Value := wwCDSMovCCTIPOCPBTE.Value;
wwCDSAplicacionesAPLICA_CLASECPBTE.Value:= wwCDSMovCCCLASECPBTE.Value;
wwCDSAplicacionesAPLICA_NROCPBTE.Value := wwCDSMovCCNROCPBTE.Value;
wwCDSAplicacionesDETALLE.Value := wwCDSMovCCDETALLE.Value;
with (Source as TwwDBGrid).DataSource.DataSet DO
begin
wwCDSAplicacionesIDMOVACTA.Value := wwCDSACtaID_MOV.Value;
wwCDSAplicacionesFECHA.Value := FieldByName('Fecha').Value;
wwCDSAplicacionesPROVEEDOR.Value := FieldByName('Proveedor').Value;
wwCDSAplicacionesID_CPBTE.Value := FieldByName('Id_Cpbte').Value;
wwCDSAplicacionesTIPOCPBTE.Value := FieldByName('TipoCpbte').Value;
wwCDSAplicacionesCLASECPBTE.Value := FieldByName('ClaseCpbte').Value;
wwCDSAplicacionesNUMEROCPBTE.Value := FieldByName('NumeroCpbte').Value;
IF Moneda3d(' ',MascaraGral, FieldByName('Importe').Value)<=Moneda3d(' ',MascaraGral, wwCDSMovCCSALDO.Value) Then
wwCDSAplicacionesIMPORTE.Value :=FieldByName('Importe').Value
else
wwCDSAplicacionesIMPORTE.Value :=wwCDSMovCCSALDO.Value;
end;
wwCDSAplicaciones.Post;
end
else
ShowMessage('Comprobante con saldo 0(cero), no se pude aplicar pagos');
end;

Moneda es una funcion mia para acotar los decimales en los reales; La propiedad del DragMode en Automatico.

espero se entienda...


La franja horaria es GMT +2. Ahora son las 12:12:05.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi