1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| procedure TFormFactor.ClientPhoneMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Single);
var
Svc: IFMXDragDropService;
DragData: TDragObject;
DragImage: TBitmap;
begin
if not ClientPhone.Text.IsEmpty and TPlatformServices.Current.SupportsPlatformService(IFMXDragDropService, Svc) then
begin
DragData.Source := Sender;
DragImage:=TBitmap.Create;
try
// DragImage.Assign(ImageList1.Bitmap(TSizeF.Create(16,16),0));
DragImage.Clear(0); // pas d'image
DragData.Data:= 'ClientPhone'; // permet de savoir ce que c'est comme label = TLabel(Sender).Name
Svc.BeginDragDrop(Self, DragData,dragImage);
finally
DragImage.Free;
end;
end;
end;
procedure TFormFactor.EdtPhoneDragDrop(Sender: TObject; const Data: TDragObject;
const Point: TPointF);
begin
EdtPhone.Text:=ReplaceStr(Fdquery2TELEPHONE.asString,' ','');
end;
procedure TFormFactor.EdtPhoneDragOver(Sender: TObject; const Data: TDragObject;
const Point: TPointF; var Operation: TDragOperation);
begin
if Sametext(Data.Data.AsString,'clientphone')
then Operation:=TDragOperation.Copy
else Operation:=TDragOperation.None;
end; |
Partager