[Chameleon] JSAPI newbie questions

Paul Spencer pagameba at magma.ca
Sun Jul 11 23:06:27 EDT 2004


Ken,

the CWCJSAPI widget is more or less broken for any version after 1.0.6 
(i.e. any of the 1.1 or 1.99 versions) up to and including the 1.99 beta 
1 version.  It should work for the beta 2 version which is to be 
released this week (pending internal qa review) for most widgets, but it 
likely still has problems that won't be fully resolved until beta 3 or 4.

I would appreciate it if you do try to use it for your project once beta 
2 is released as this will give me some real feedback :)

Cheers,

Paul

Ken Sanderson wrote:

> Hello all.
> 
> Now that I have chameleon up and running I thought the best way to get
> things rolling on the learning curve was to dive in and use it for an
> upcoming project. The project has the requirement of a tool where the
> user clicks on the map, I get the coordinates for that click, and then I
> go and do something with those coords. Fairly straight forward.
> 
> After reading the docs on widgets and JSAPI I decided likely the JSAPI
> was a good way to go and further decided to start off by implimenting
> the example in the JSAPI docs.
> 
> So first I added the two lines up below the rest of the shared
> resources:
> 
> <CWC2 TYPE="SharedResource" NAME="CWCJSAPI"/>
> <CWC2 TYPE="CWCJSAPI" Debug="false"/>
> 
> This I gather should tell things that I am using JSAPI.
> 
> I then added the event register to the myOnLoad() function like:
> 
> function myOnLoad()
> {
>   CWC2OnLoadFunction();
>   goCWCApp.RegisterEvent( MOUSE_CLICKED,
>                         "myMouseClicked");
> }
> 
> Then I pasted in the myMouseClicked function from the JSAPI docs, like:
> 
> function myMouseClicked()
> {
>   oMap = goCWCApp.oMap;
>   mousePos = "(" + oMap.mouseclick[0] + ","
>                  + oMap.mouseclick[1] + ")";
>   alert("mouse clicked at " + mousePos);
> }
> 
> So now my question. What have I done wrong or missed doing? By added the
> above it more or less breaks the page. Is it because I have not set it
> to tell the other widgets to not operate, ie if the tool selected is
> zoomin, then its going to zoomin as well as my little function?
> Obviously I am going to want to change it so it only does my function,
> but can you have both if you wanted too?
> 
> Any suggestions appreciated, as well as tips, tales and stories from
> those more experienced with the JSAPI.
> 
> Thanks,
> 
> Ken Sanderson
> Miistakis 
> 
> 
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           pspencer at dmsolutions.ca   |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------



More information about the Chameleon mailing list