How to get image pressed event if window has two images which are same size and same position ?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • How to get image pressed event if window has two images which are same size and same position ?

    Hi everybody!

    My project have a window which has two images.
    These images have same size, same position (at the center of window) and I call them as image_1 and image_2.
    Firstly, I set image_1 with bitmap data bmp11, image_2 with bitmap data bmp_21.
    Then, when I press on image_1, I want to change the bitmap data of both image_1 and image 2. from bmp11 to bmp12 for image_1 and from bmp21 to bmp22 for image_2.
    The problem is that when I press on image_1, the data of those images are not changed. It seems I can not catch the image_1 pressed event. I guess that happens because image_1 and image_2 are in the same position and size.



    Could you please help me to fix this problem? I also attach my source code for you to check.


    Thank you!
    Files
    • Test.zip

      (23.85 kB, downloaded 190 times, last: )
  • Hi,

    Yes you are right. The topmost widget image_2 catches the input and it never get through to image_1.

    Attached is your example with a small change which makes it working. You can either react on release of image_2 or react on both widgets in the 'same' case. Search for '/****/' to find my changes.

    I had a good laugh once it was working. Didn't expected such an image.

    Another point is that you set an empty BMP data. It is working but I don't recommend to do this. Better would be to set simply no image for image_2.

    Regards
    Sven
    Files
    • Test.zip

      (22.63 kB, downloaded 209 times, last: )
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.