Bug 422

Summary: Scale widget does not implement WIDGETCLASS parameter
Product: Chameleon Reporter: Bart van den Eijnden <bartvde@osgis.nl>
Component: WidgetAssignee: Bart van den Eijnden <bartvde@osgis.nl>
Status: RESOLVED FIXED    
Severity: enhancement CC: jmckenna@gatewaygeomatics.com
Priority: P2    
Version: 1.99   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description From 2004-05-28 07:28:20
The scale widget does not implement the WIDGETCLASS parameter using which you 
can use css to change the appearance of the widget.

Maybe there are more widgets that would need this parameter but don't use it? 
The only one I have encountered so far is the Scale widget.

Also it would be nice to have a KeyPress event on the Scale widget as an 
enhancement. Here is the code I use:

in drawPublish:
<INPUT OnKeyPress=\"KeyPressed(event)\"  ...

In GetJavascriptFunctions:

  $szJsFunctionName = "KeyPressed";
  $szFunction = <<<EOT
/**
 * {$szJsFunctionName}
 * called to register and even when the map extents chnages (JSAPI)
 */
function {$szJsFunctionName}(e)
{
	if (!e) var e = window.event;
	var code = e.keyCode;
	if (code == 13)
	{
          document.forms[0].UPDATE_MAP.value = "1";
	  document.forms[0].submit();
          return;
	}
}
EOT;
$aReturn[$szJsFunctionName] = $szFunction;
------- Comment #1 From 2004-05-30 21:11:05 -------
Agreed on the widget class.  Also, it should implement WIDGETSTYLE as per other
widgets.  Please proceed and implement both at your leisure.

Re the keypress event, I like this idea but I don't want this to be something
that will always be there.  Please implement as a new attribute
(SUBMITONKEYPRESS="[true|false]" (name?), but the default can be true.

Instead of document.forms[0], please use {$this->mszHTMLForm} because widgets
can now be part of any arbitrary form on a page ... use of document.forms[0] is
deprecated and in fact dangerous, and needs to be removed from any existing code
that still uses it (and there is some, I'm sure).

Are there any other widgets that could benefit from this handy piece of code?
------- Comment #2 From 2004-05-31 15:59:37 -------
*** Bug 30 has been marked as a duplicate of this bug. ***
------- Comment #3 From 2004-07-05 09:56:45 -------
Code is now in CVS (revision 1.3 of Scale.widget.php).