[Chameleon] Creating my own Widget

Ken Sanderson ken at rockies.ca
Fri Sep 10 13:29:29 EDT 2004

When I created my Nav tools widget I needed to add some changes to the
MapDHTMLWidget.js file in the MapDHTMLWidget folder in the widgets

Open that file and look in the functions:

MapWchkMouseUp, MapWmapTool, and MapWgetMouse.

There are parts in each of those that look something like this:

    if((window.gMapDHTMLForm != null) && 
       (gMapDHTMLForm.NAV_CMD != null) &&
       (gMapDHTMLForm.NAV_CMD.value == "PAN_MAP" ||
        gMapDHTMLForm.NAV_CMD.value == "RULER" ||
        gMapDHTMLForm.NAV_CMD.value == "QUERY" ||
        gMapDHTMLForm.NAV_CMD.value == "GetPoint"))
        return true;

Its slightly different in each one, but you will be able to recognize
it. GetPoint is my widget, you can see how I added it there. Basically
since QUERY is in every one I suspect that a query type widget also
needs to be there, so put your own widget name in those lists.


-----Original Message-----
From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Robin Robin
Sent: September 10, 2004 7:51 AM
To: chameleon at lists.maptools.org
Subject: [Chameleon] Creating my own Widget

Hello all,

I am trying to create my own widget and I am running into some problems.
am trying to create a hotlink widget which will work similar to identify
will open a webpage when the location on the map is clicked.  I plan to
this by copying and modifying the query widget.

I started by simply copying the query widget and renaming it.  I wanted
check that it still worked once the name has been changed.  It doesn't!
far, I changed the folder name to Hotlink, I have changed
to HotlinkResults.phtml and Query.widget.php to Hotlink.widget.php.  I
also changed in Hotlink.widget.php the class and constructor names from 
Query to Hotlink (as per instructions in an old thread I found in the 
chameleon archives).

When I click on my hotlink button the map redraws and nothing happens.
If I 
click the same point with my identify/query button I get a popup window
the query results.  Since I haven't changed any of the actual
yet, both buttons should produce the same results.

Are there other places where I have to change/add to files so that my
widget will be recognized?  In an older message someone mentioned
the MapDHTMLWidget.widget.php but I couldn't tell where it should be
(I did a text search for query).

Any help would be appreciated.


The new MSN 8: advanced junk mail protection and 2 months FREE* 

Chameleon mailing list
Chameleon at lists.maptools.org

More information about the Chameleon mailing list