2

We try to make an image clickable for some time within the Image Viewer. In my view, there is no listener for it?

We have a gallery of images. After clicking on an image that is to be opened in a separate window.

In another thread we found the opportunity to put any image on a button. For this we need to restructure our gallery, what we want to avoid

Here is the code for opening the image. This works well so far:

Form picture = (Form) createContainer(res, "ImageViewer");
beforeImageViewer(picture, currentObjektModel);
picture.showBack();
postImageViewer(picture, iv.getImageList().getItemAt(iv.getImageList().getSelectedIndex()));
Hash
  • 4,647
  • 5
  • 21
  • 39

1 Answers1

0

The problem with doing that is that image viewer handles pointer events for swipe/pan which you rely on. You can use ScaleImageButton for most cases but since you need swiping this is probably not an option.

You can derive image viewer and override pointerPressed & pointerReleased.

If pressed is called with released almost immediately after and the distance between the two x/y coordinates (from the pressed/released) is small then that's probably a click.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • the solution with pointers sounds very interesting. now that the requirements have changed, we can solve it differently. a picture for the detail page and a button with "more pictures .." what image viewer opens. Thanks for your help – Marco Grabmüller Aug 25 '16 at 06:48