GX_ANIMATION_SCREEN_DRAG for SSP 1.2.0

Hello,

 

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?

 

Regards,

isaenz.

  • Hi Isaenz,

    Any updates with your concern? Were you able to use GX_ANIMATION_SCREEN_DRAG with SSP 1.2.0?

    JB
    RenesasRulz Forum Moderator
  • In reply to JB:

    Hello ,
    No, no updates on this matter.

    isaenz.
  • In reply to isaenz:

    Hello 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.

    Best regards,
    anper

  • In reply to anper:

    Hello  

    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?

     

    Regards,

    isaenz.

  • In reply to isaenz:

    Hello isaenz,

    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).

    Ad. 1:

    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.

    Ad. 2:

    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.

    Best regards,
    anper

  • In reply to anper:

    Hello  

    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.

    Thanks!

    isaenz.

  • In reply to isaenz:

    Hello isaenz,

    I will try to prepare a simple example for PE-HMI1.

    Best regards,
    anper

  • In reply to anper:

    Hello ,

    any news on this matter?

    Regards,
    isaenz
  • In reply to isaenz:

    Hello isaenz,

    it is on the go. When I was writing my earlier post I was using a SK-S7G2 board. I try to do the same using PE-HMI1. Hopefully today I will be able to post it here.

    Best regards,
    anper

  • In reply to anper:

    Hello isaenz,

    please find enclosed an example project of drag and drop functionality for a PE-HMI1, SSP 1.2.0. It is based on the "GUIX Hello World" project.

    2727.GUIApp_drag_PEHMI1_120.zip

    The key parts of the code are:

    • w1_prompt1_handler() function, guiapp_event_handlers.c:51
    • w1_prompt2_handler() function, guiapp_event_handlers.c:78
    • drag_and_drop() function, guiapp_event_handlers.c:158

    Two additional functionalities, "snap to" and "swap", need to be implemented.

    Best regards,
    anper

  • In reply to anper:

    Hello

    We have implemented the example you sent us in our platform, and the behaviour is more or less the expected. But now we are facing another problem. The functionality of the button, the one that has to be dragged, was to enter another window that is why the button event was handled inside the window with the GX_SIGNAL(IdWidget, GX_EVENT_CLICKED) function. Now we have created the new button handler to incorporate the new drag and drop functionality, if we disable the previous CLICKED event the widget moves smoothly but when we enable the CLICKED functionality it is executed when the system detects the PEN_DOWN event and not the UP, generating an undesirable effect. It enters the new window without moving the widget.
    The rest of the buttons in the same windows and with the same GX_SIGNAL(IdWidget, GX_EVENT_CLICKED) function are executed when the PEN_UP event is detected. Why this new behaviour? Is it because we have created the new button handler? or is it because the FOCUS option selected in the GUIX button properties?

    Thanks in advance for your help!!

    Imanol
  • In reply to Imanol:

    Hello Imanol,

    the behavior which you observe is caused by the order of GUIX events. Looking carefully at them in Debug mode, I determined that the GX_EVENT_CLICKED event (received in the parent window event handler) precedes the GX_EVENT_PEN_DRAG event (received in the dragged widget event handler). Additional logic could be required as a solution, to ignore GX_EVENT_CLICKED (or GX_EVENT_PEN_UP) events while dragging is expected. Please refer to the modified project:

    1016.GUIApp_drag_PEHMI1_120.zip

    Please also notice that there are some GUIX issues in the SSP 1.2.0, which are fixed in newer SSP versions.

    Best regards,
    anper

  • In reply to anper:

    Hello Anper,

    Thank you for the new project. Now events are working correctly and the PEN_UP event creates the desired action. Now we are suffering another side effect, when the button is moved above another button it creates a kind of flicker in the screen. I think that the system is trying to maintain the button in the top layer of the screen and it creates this flicker in the screen. Is it possible to eliminate or at least reduce this behaviour?

    Best regards

    Imanol
  • In reply to Imanol:

    Hello Imanol,

    I don't experience such issue. However, I do see that the fast movement of the widget is noticeably ragged. This can be reduced by increasing the "Update Hz" property of the Touch Panel Framework:

    Do you observe the flickering while running the project shared in my previous post or while running your own project? Do you see it on the PE-HMI1 board?

    Best regards,
    anper

  • In reply to anper:

    Hello Anper,

     

    We have ported the mechanisms you show us in our previous post to our platform. You can see a video with the behaviour attached to the post.

    Best regards

     

     Imanol