Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canvas_View: limiting drag of items is not working #53

Open
fdesp87 opened this issue Oct 3, 2023 · 0 comments
Open

Canvas_View: limiting drag of items is not working #53

fdesp87 opened this issue Oct 3, 2023 · 0 comments

Comments

@fdesp87
Copy link

fdesp87 commented Oct 3, 2023

As an example, if the program defines the handler for item movement as:

   function On_Item_Event_Move_Item
        (View   : not null access Glib.Object.GObject_Record'Class;
         Event : Event_Details_Access)
      return Boolean
   is
   begin
      Event.Allowed_Drag_Area := Some_Rectangle;
      return Gtkada.Canvas_View.Views.On_Item_Event_Move_Item (View, Event);
   end On_Item_Event_Move_Item;

and then the handlers:

 Canvas.On_Item_Event (On_Item_Event_Select'Access);
 Canvas.On_Item_Event (On_Item_Event_Move_Item'Access);

However, dragging is not limited in any way.

Diving into the problem, I commented out gtkada-canvas_pkg.adb line 509:

  .....

  then
     --  Enable moving the item anywhere
     --  ===> JLF 2023-10-03 Event.Allowed_Drag_Area := Drag_Anywhere; <===
     Self.Model.Raise_Item (Event.Toplevel_Item);
     return True;
  end if;
  return False;

end On_Item_Event_Move_Item;

and voilá, dragging is now limited to the rectangle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant