<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
It looks like I have the right code. I think the problem is with the
styleValue routine. I have had to modify the following code in the draw
function:<br>
<br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var vertDisp = 0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(var classIndex = 0; classIndex &lt; classNames.length;
++classIndex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var cls = classNames[classIndex];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vertDisp = Math.max(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vertDisp,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.styleValue(cls, 'top') + this.styleValue(cls,
'height')<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (vertDisp == 0) vertDisp = 30;<br>
</tt><br>
The vertDisp value was coming out to be zero. By adding the last line
and setting it to 30 it helped, but the bar still looks a bit off. I
load a number of style sheets and I think that there is an issue with
one that is causing the problem. I suspect the following code in
styleValue:<br>
<br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; allRules = sheet.rules;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; allRules = sheet.cssRules;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
</tt><br>
I am wondering if the "break;" should be a "continue;"? Any thoughts?
David<br>
<br>
Tim Schaub wrote:
<blockquote cite="mid:479AD300.4070100@openplans.org" type="cite">
  <pre wrap="">Hey-

David R Robison wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I was using the one in the tschaub sandbox. David

    </pre>
  </blockquote>
  <pre wrap=""><!---->
If you take a look at the patch for the scale bar, you'll see there are 
some changes required to the default stylesheet.

<a class="moz-txt-link-freetext" href="http://trac.openlayers.org/attachment/ticket/24/scalebar.patch">http://trac.openlayers.org/attachment/ticket/24/scalebar.patch</a>

In addition, you'll want to add your stylesheet with a link tag instead 
of relying on the default dynamically added stylesheet.

&lt;link rel="stylesheet" href="../theme/default/style.css" type="text/css" /&gt;

Thanks for trying it out.  Write back if you still have any trouble with it.

Tim


  </pre>
  <blockquote type="cite">
    <pre wrap="">Christopher Schmidt wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">On Mon, Jan 21, 2008 at 06:43:27PM -0500, David R Robison wrote:
  
      </pre>
      <blockquote type="cite">
        <pre wrap=""> I am trying to get the OpenLayers.Control.ScaleBar working. I've added 
it to my map according to the example html. However, when my map draws, 
I get the units (in my case 'miles') but it displays at the bottom of 
the map and I get no scale bar. Its as if the scale bar is below the map 
and hidden. Any thoughts on how to get this to work correctly? Thanks, David
    
        </pre>
      </blockquote>
      <pre wrap="">Are you adding ScaleBar (which isn't in trunk) or Scale()? OpenLayers
does not currently have a ScaleBar control.   

Regards,
  
      </pre>
    </blockquote>
    <pre wrap="">-- 

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: <a class="moz-txt-link-abbreviated" href="mailto:drrobison@openroadsconsulting.com">drrobison@openroadsconsulting.com</a>
web: <a class="moz-txt-link-freetext" href="http://openroadsconsulting.com">http://openroadsconsulting.com</a>
blog: <a class="moz-txt-link-freetext" href="http://therobe.blogspot.com">http://therobe.blogspot.com</a>
book: <a class="moz-txt-link-freetext" href="http://www.xulonpress.com/book_detail.php?id=2579">http://www.xulonpress.com/book_detail.php?id=2579</a>

 

!DSPAM:4033,4795347f311362458217002!


------------------------------------------------------------------------

_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>


!DSPAM:4033,4795347f311362458217002!
    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 

David R Robison
Open Roads Consulting, Inc.
708 S. Battlefield Blvd., Chesapeake, VA 23322
phone: (757) 546-3401
e-mail: <a class="moz-txt-link-abbreviated" href="mailto:drrobison@openroadsconsulting.com">drrobison@openroadsconsulting.com</a>
web: <a class="moz-txt-link-freetext" href="http://openroadsconsulting.com">http://openroadsconsulting.com</a>
blog: <a class="moz-txt-link-freetext" href="http://therobe.blogspot.com">http://therobe.blogspot.com</a>
book: <a class="moz-txt-link-freetext" href="http://www.xulonpress.com/book_detail.php?id=2579">http://www.xulonpress.com/book_detail.php?id=2579</a>

 </pre>
</body>
</html>