changing pointer to colorful picture
1 view (last 30 days)
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
pos = get(fig_handle, 'currentpoint'); % get mouse location on figure
x = pos(1);
y = pos(2); % assign locations to x and y
% get button width and height
target_pos = get(Button,'position');
tw = target_pos(3); th = target_pos(4);
% update button position based on the computed x,y locations
target_pos = [x-dx, y-dy, tw, th];