Le drag&drop fonctionne-t-il sur Sidney ?
Bonjour,
je relance ce sujet qui date déjà un peu, je travaille sous Seattle qui date également un peu :), alors ma première question:
Est ce que vous savez si le dragNdrop est désormais géré sous Android pour les nouvelles version Sydney?
j'ai utilisé l'unité a Paul Toth: "Execute.FMXBasedDragDrop" sur un projet Android.
ça marche parfaitement sur un écran 7 pouces.
par contre sur un téléphone 5 pouces android 9, la taille de l'image Shadow ombrée de l'objet a dragger est beaucoup plus grande que l'objet lui même...
est ce que vous avez ce même problème?
il doit y avoir un truc a faire du coté de la fonction mais je sèche...
Code:
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 36
| procedure TFMXDragDrop.BeginDragDrop(AForm: TCommonCustomForm; const Data: TDragObject; ABitmap: TBitmap);
var
Mouse: IFMXMouseService;
begin
if FImage = nil then
begin
// the mouse position is not available, TCommonCustomForm.FMousePos would be a good candidate if it was not private
// request the IFMXMouseService on the TForm to see if it is provided
if IInterface(AForm).QueryInterface(IFMXMouseService, Mouse) <> 0 then
begin
// now request the TPlatform, but this ony is not updated when MouseDown occurs and the first image position will be wrong
if not TPlatformServices.Current.SupportsPlatformService(IFMXMouseService, IInterface(Mouse)) then
Exit;
end;
FImage := TDragImage.Create(nil);
FImage.FMouse := Mouse;
end;
FImage.Parent := AForm;
FImage.FData := Data;
FImage.FOrigin := FImage.FMouse.GetMousePos(); // AForm.FMousePos would be great
FImage.SetBounds(
FImage.FOrigin.X - ABitmap.Width/2,
FImage.FOrigin.Y - ABitmap.Height/2,
ABitmap.Width,
ABitmap.Height
);
FImage.Bitmap.Assign(ABitmap);
FImage.Opacity := 0.5;
FImage.FOrigin.X := FImage.Position.X - FImage.FOrigin.X;
FImage.FOrigin.Y := FImage.Position.Y - FImage.FOrigin.Y;
TOpenForm(AForm).SetCaptured(FImage); // need an access to TCommonCustoForm.FCaptured
end; |