Drag and drop control or group of controls

Drag and drop control or group of controls

BY 24 Sep 2013 Native Application Development

Hi
I want allow moving of button on Form (drag and drop).
I just found one way:
I have registered IDragDropEventListener for button at first:
        pButton1->AddDragDropEventListener(*this);
        pButton1->SetDragEnabled(true);
and reimplement OnTouchDragged(…)
{
    if (source.GetName() == L”IDC_BUTTON1″)
    {

        Rectangle button;
        Button* pButton1 = static_cast< Button* >(GetControl(IDC_BUTTON1));
        pButton1->GetBounds(button.x,button.y,button.width,button.height);
        button.x=button.x-(button.width/2)+currentPosition.x;
        button.y=button.y-(button.height/2)+currentPosition.y;
        pButton1->SetPosition(button.x,button.y);

    }
}
p.s. I did not use OnTouchDropped, currentPosition incoming params are equal with latest OnTouchDragged().

What known ways are presented in Tizen to drag and drop control or group of controls also?
Are there any properties for any custom elements(controls) to allow them be movable automatically?
Alexey.

Written by