is there any way to use GX_ANIMATION_SCREEN_DRAG with SSP 1.2.0? Or anyway to implement drag-and-drop functionality with SSP 1.2.0?
In reply to JB:
In reply to isaenz:
the GX_ANIMATION_SCREEN_DRAG type of animation is not available in SSP 1.2.0.
Could you specify what final result would you like to get? Animation for changing window or animation for moving some widget around the screen to place it in desirable place?
I will see what can be done with SSP 1.2.0 to achieve similar functionality.
In reply to anper:
we want to implement two functions:
1. Move an image (or an object) from one place to another (the positions are preset, let's say there are two icons and we want to move the image from one to another):
2. Change the positions of two images (or objects). Almost same assumption as previous case; let's say we have two icons and want their images to be exchanged:
We would like the image dragged to follow the touch, I mean, we'd like it to move along with our finger.
Do you see it possible to implement this with SSP 1.2.0?
I managed to implement simple drag and drop functionality in the following way:
In GUIX Studio I added an event function for the widget which is going to be dragged. In the definition of this function I handle the GX_EVENT_PEN_DRAG event and call the gx_widget_shift() function. The x_shift and y_shift parameters can be calculated based on the GUIX event coordinates, which are accessible through the event_ptr->gx_event_payload.gx_event_pointdata (where event_ptr is a pointer to the event structure).
To be able to drop the dragged widget only in the predefined places you can implement some sort of array containing predefined coordinates. Then you would have to implement the logic which will move the dropped widget to the closest predefined point. The gx_widget_shift() function can be used for this purpose again.
To swap two widgets you would have to additionaly move the widget which is going to be replaced by the dropped one. To do that you could compare their coordinates and, if they are the same, make the swap. Again the gx_widget_shift() function can be used for this. The coordinates of the widget can be obtained through the widget->gx_widget_size (where widget is a pointer to the widget structure). This is in case of a prompt widget. For other types of widgets it should be similar however.
Could you share with us the code you developed? We're using a custom board, but we also have a PE-HMI1, so if you could translate it to this board (SSP1.2.0) it would be great.
I will try to prepare a simple example for PE-HMI1.