[Chameleon] Widgets or JSAPI (Modifying Customized Query Results)

Seiple, Timothy E timothy.seiple at pnl.gov
Wed Aug 17 17:35:23 EDT 2005


 
Does the Link widget have map querying functionality? When I click on
the button generated by the Link Widget the cbLocation() executes
immediately (e.g. without any x,y values).  There is no opportunity to
click on the map.  How is the ON_QUERY event being triggered?


-----Original Message-----
From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Jason
Fournier
Sent: Wednesday, August 17, 2005 11:28 AM
To: chameleon at lists.maptools.org
Subject: Re: [Chameleon] Widgets or JSAPI (Modifying Customized Query
Results)

Your template would contain:

1) goEventManager entry in the onload of your template:

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

2) You would place a link widget (javascript, not href) in your template
that refers to cbLocation as the js callback.

3) cbLocation would be somewhere inside script tags in your template:

<script>

  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();
  }

</script>

4) Place CursorPos widgets in the template somwhere.


The order of events would be:

1) User clicks a button in your regular html application that launches a
chameleon instance/app.
2) User clicks on the 'select location' button (ie, the link widget you
put in the template).  Alternatively I believe you can make this button
selected by default.
3) User selectes location on the map.
4) The callback (cbLocation) gets fired because you've registeres
ON_QUERY in your onload.
5) cbLocation grabs the location from the CursorPos widget and pass
those variables back to the opener (your other app).
6) Chameleon closes itself.


I don't think the ON_QUERY has made it to the documentation just yet.  I
happen to know about it because I helped put it there.

Jay



More information about the Chameleon mailing list