[Chameleon] Widgets or JSAPI

Seiple, Timothy E timothy.seiple at pnl.gov
Wed Aug 17 14:10:41 EDT 2005


I'm starting to see the light... For clarification though:

The order of events will be 1) Use the customized Query widget to get
and store the {x,y} in variables rather than display results.  Then use
a Link widget to get back to the calling application, taking along the
x,y variables somewhere in the http header.  Is this right?

I did not see ON_QUERY in the event details section of the chameleon
documentation.  How did you know about this event?  Are there more that
I am missing?


-----Original Message-----
From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Jason
Fournier
Sent: Tuesday, August 16, 2005 8:13 PM
To: chameleon at lists.maptools.org
Subject: Re: [Chameleon] Widgets or JSAPI

After some deep Chameleon soul searching I remembered the Customizing
Query Results:

http://chameleon-tiki.maptools.org/tiki-index.php?page=QueryWidgetCustom
izingResults 


This is a relatively simple method of accomplishing your task without
having to create a widget.  Basically, you will have a link widget
which, when used, gets intercepted by the Global Event Manager.  At this
point you can call anything you want in javascript.

You shouldn't have to get e or event for this IF you include the
CursorPos widget (for X & Y).  In your js callback you will be able to
get the coordinates via the form variables:

document.formname.CursorPos_X.value
document.formname.CursorPos_Y.value

So, let's say that in your body onload you specify:

goEventManager.registerForEvent( 'ON_QUERY', 'cbLocation' );

so that when you perform a 'query' the following gets called:

function cbLocation()
{
      var nX = document.formname.CursorPos_X.value;
      var nY = document.formname.CursorPos_Y.value;
      window.opener.document.formname.nXLocation.value = nX;
      window.opener.document.formname.nYLocation.value = nY;
      self.close();
}

Although I haven't tested this code it should work.  CursorPos_X and
CursorPos_Y do all the work for you in getting the coords.  You just
have to reference them and pass them back to your opener.

Make sense?

Jay



More information about the Chameleon mailing list