Home Forums FlexGanttFX Allow vertical dragging in GanttChart

Viewing 1 reply thread
  • Author
    • Felix
      Post count: 5
      #12834 |

      How can I allow vertical dragging of activities in my GanttChart, and is there a Drop-event I can listen to, to know where the activity was dropped?

    • Dirk Lemmermann
      Post count: 69
      #12841 |

      Move the mouse cursor on top of an activity while pressing the SHIFT key. This will allow you to move the activity horizontally and vertically at the same time. If you press the SHORTCUT key (cmd on Mac, CTRL on Windows) then you can do a vertical drag only. You can modify this behavior by using the setActivityEditingCallback() and the setEditModeCallback() methods.

      // answers the question: where do I need to place the mouse cursor to perform which editing operation?
      getGraphics().setActivityEditingCallback(MyActivity.class, param -> param.getEditMode().equals(GraphicsBase.EditMode.DRAGGING_VERTICAL));

      // answers the question: which editing operations are supported by my activity type?
      getGraphics().setEditModeCallback(MyActivity.class, GanttLayout.class, param -> GraphicsBase.EditMode.DRAGGING_VERTICAL);

      This will make sure that you can immediately perform a vertical drag on an activity when you move the mouse cursor on top of an activity. It also ensures that dragging vertically is the ONLY editing operation that the user can perform.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.