cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

How to create a ListBox with dragable/movable (drag & drop) item?

ReignBough
Booster
I am creating a dialog with list box. The items should me dragable/movable to any row. I am using ListBoxObserver but I am unable to do it.
~ReignBough~
ARCHICAD 24 INT 4018 FULL (from AC18)
Windows 10 Pro, Intel Core i7-4790 CPU @ 3.60GHz, 32.0GB RAM, 64-bit OS
1 ACCEPTED SOLUTION
2 REPLIES 2

Solution
Oleg
Advocate
There is 2 way

1. Full Drag-Drop

Call the EnableDragAndDropEvent() for panel (dialog)

Implement Drag-Drop handlers of the ListBoxObserver (ListBoxDragSourceObserver, ListBoxDropTargetObserver), at last
ListBoxDragStarting, ListBoxDragStarted, ListBoxDragEntered, ListBoxDragMoved, ListBoxDropped

2. Simple row dragging

Create an "drag" icon column. Fill it the DG::ListBox::DragIcon or any other.

Call list.EnableMouseMoveEvent() for the list box

Implement ListBoxMouseMoved( const DG::ListBoxMouseMoveEvent& ev, short* inArea );
When a mouse will be over the drag icon column, assign *inArea = DG::ListBox::DragArea.

Implement ListBoxItemDragged( const DG::ListBoxDragEvent& ev ) to handle dragging

ReignBough
Booster
Thank you.

The error in my code was in ListBoxMouseMoved() function since I follow the documentation:
virtual void ListBoxMouseMoved (
    const ListBoxMouseMoveEvent & ev,
    bool *              inDragArea
);
It is now working after I changed it to short.
~ReignBough~
ARCHICAD 24 INT 4018 FULL (from AC18)
Windows 10 Pro, Intel Core i7-4790 CPU @ 3.60GHz, 32.0GB RAM, 64-bit OS

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!