Bug 606

Summary: makeButton: more javascript parameters
Product: Chameleon Reporter: Bart van den Eijnden <bartvde@osgis.nl>
Component: CoreAssignee: chameleon-dev <chameleon-dev@lists.maptools.org>
Status: RESOLVED INVALID    
Severity: enhancement    
Priority: P2    
Version: 1.99   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description From 2004-07-30 03:55:45
The makeButton function can currently only take 1 javascript parameter, which is
pretty limiting. Maybe the makeButton function should stop adding quotes around
the parameter in case it's a string parameter, so that an application developer
can just add in a comma separated parameter string. Or it should be possible to
pass in an array.

As a workaround I had to add my own link around the button <a> and give the
makeButton function a dummy empty javascript function as a first argument,
otherwise it does not hover.

Any thoughts?
------- Comment #1 From 2004-07-30 13:15:37 -------
you can pass an array as a paramater and it should be converted into a
javascript array when passed to your javascript function.  You just need to know
what is in the array :)
------- Comment #2 From 2004-07-30 14:02:15 -------
Paul, so this means it is an assumption of the button API to only support 
javascript functions on the onClick event which take 1 parameter? A simple 
parameter, or an array or object? But not functions which take 2 or more simple 
parameters?
------- Comment #3 From 2004-08-04 08:24:05 -------
that's correct.  To support multiple simple parameters, you need to put them
into an array.  But I think it should be possible to support multiple
parameters.  I've become a fan of the 'arguments' array in javascript functions
recently:

function varArgs( /*variable number of arguments*/ )
{
  var i;
  var szArgs = "";
  var szSep = "";
  for (i=0; i<arguments.length; i++)
  {
    szArgs = szArgs + szSep + arguments[i];
    szSep = ",";
  }
  alert( "arguments were " + szArgs );
}