Hi Tim

inline reply

Tim Squires wrote:
Thanks Nino,

The model is just a quick hack to show where the imageresource is coming from, i.e. it's dynamic.
ahh...

The ClientSideImageMap and the older ImageMap don't give an x and y of the click and I don't fancy creating a <map/> for every pixel in the image.
I surely understand...

The ImageButton does return where the user clicked on the image as part of the form submit. I was hoping that the x and y could be mapped to a model somehow.
It should be possible I think..

How I managed to get the coords is like this

           Form<Object> form = new Form<Object>("form") {
               @Override
               protected void onSubmit() {
                   info("x = " + getRequest().getParameter("picture.x"));
                   info("y = " + getRequest().getParameter("picture.y"));
               }
           };

It would be nice to attach these values to a property, can you see a way of doing that?
It reminds me of something. IF you combine this technique:

https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-contrib-openlayers/src/main/java/org/wicketstuff/openlayers/event/EventListenerBehavior.java

im thinking of this method : protected abstract void onEvent(AjaxRequestTarget target);

So combine above with how an ordinary link or button works you should be able to pass on parameters either as a model or as nice parameter eg : protected abstract void onClick(Double x, Double y);

If you have questions just ask..

Tim

Nino Saturnino Martinez Vazquez Wael wrote:
maybe james patch can help you : http://www.nabble.com/Client-Side-Image-Map...-td20516107.html#a20516107 ?

Otherwise it should be  ImageMap already there..
Nino Saturnino Martinez Vazquez Wael wrote:
Hi Tim

You should get a grasp on models. But isnt it an imagearea (cant remember the exact name) or something you want? Image button is just a button which has a image...

Tim Squires wrote:
Hi,

I'm trying to retrieve the x and y coords from a user click on an ImageButton. Can anyone tell me how to get these parameters in an onSubmit method?

Currently I'm doing

final IModel<Picture> picture = new AbstractReadOnlyModel<Picture>() {

               @Override
               public Picture getObject() {
                   return pictureService.findRandom();
               }
           };

           Form<Object> form = new Form<Object>("form") {
               @Override
               protected void onSubmit() {
// picture.x and picture.y parameters, where are they?
               }
           };

form.add(new ImageButton("picture", new ImageResource(defaults
                   .getPicturesLocation(), picture)));

           add(form);

but cannot find any way of retrieving the page parameters in the onSubmit() - getPageParameters() returns null.

I'm using 1.4-rc1.

Thanks for any help,
Tim

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to