I am working on an app with a drag and drop functionality. this means that buttons can be dragged by the user.
at the moment, the functionality is based on the code attached at the bottom, which is set as the WindowButtonMotionFcn of the app under certain conditions. however, this runs relatively slowly, especially when there are many components.
i was thinking of changing the method completly, and instead change the pointer itself into a picture of the button that the user can drag around. however as far as I saw the pointer can only be set to a black and white 16*16 or 32*32 picture. this is despite the fact that pointers in general can be colorful and large in many applications. (even the "watch" pointer in matlab itself is colorful) is there a way around this?
alternatively, is there a way to accelerate the attached function? I think one of the problems is that the app renders all the graphical components even when you drag one tiny button. is there a way to overcome this?
many thanks in advance
function Drag_Component(fig_handle,~,Button,dx,dy)
pos = get(fig_handle, 'currentpoint');
target_pos = get(Button,'position');
tw = target_pos(3); th = target_pos(4);
target_pos = [x-dx, y-dy, tw, th];
set(Button,'position', target_pos);