i ran into an interesting problem that igor helped me solve yesterday.  i
wanted to get the X, Y coordinate when the user clicks on an image instead
of using an image map because of some very fancy hit-testing and logic i
wanted to do on the server.  image maps were not cutting it.  anyway, what
we came up with was this useful piece of code:

        image.add(new AjaxEventBehavior("onclick") {

            @Override
            protected CharSequence getCallbackScript(
                                                     boolean
onlyTargetActivePage) {
                return generateCallbackScript("wicketAjaxGet('"
                        + getCallbackUrl(onlyTargetActivePage)
                        + "&x=' + event.offsetX + '&y=' +
event.offsetY");
            }

            @Override
            protected void onEvent(AjaxRequestTarget target) {
                WebRequest request = ThoofWebRequest.get();
                final Map<String, String[]> parameters = request
                        .getParameterMap();
                final int x = Integer.parseInt(parameters.get("x")[0]);
                final int y = Integer.parseInt(parameters.get("y")[0]);


-- 
View this message in context: 
http://www.nabble.com/beyond-image-maps-tf4437219.html#a12659672
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to