The problem with Layer.Text is that it accepts a tab delimited file
while I wanted to pass coords, a title and a description for a marker.<br><br>I was able to do do that with adding a few parameters to location and with some editing of the Text.js file.<br><br>Here are the new variables:<br>
<br>    layerToUse:null,<br>    newLon:null,<br>    newLat:null,<br>    newTitle:null,<br>    newDesc:null,<br>    newIcon:null,<br><br>layerToUse places the marker on an existing layer instead of creating a new one (functionality I was looking for).<br>
<br>And also changed the following code:<br><br>    loadText: function() {<br>        if (!this.loaded) {<br>            if (this.location != null) {<br><br>                var onFail = function(e) {<br>                    this.events.triggerEvent(&quot;loadend&quot;);<br>
                };<br><br>                this.events.triggerEvent(&quot;loadstart&quot;);<br>                OpenLayers.Request.GET({<br>                    url: this.location,<br>                    success: this.parseData,<br>
                    failure: onFail,<br>                    scope: this<br>                });<br>                this.loaded = true;<br>            }<br>            else if (this.newTitle != null &amp;&amp; this.newDesc != null) {<br>
                this.parseData();<br>            }<br>        }    <br>    },  <br><br>    parseData: function(ajaxRequest) {<br>        if (ajaxRequest != null) {<br>            var text = ajaxRequest.responseText;<br>        } else {<br>
            if(this.newIcon == null) this.newIcon = &quot;&quot;;<br>   
        var text = &quot;point\ttitle\tdescription\ticon\n&quot; + this.newLat +
&quot;,&quot; + this.newLon + &quot;\t&quot; + this.newTitle + &quot;\t&quot; + this.newDesc + &quot;\t&quot; +
this.newIcon + &quot;\n&quot;;<br>        }<br>        var options = {};<br><br>as well as<br><br>            data[&#39;overflow&#39;] = feature.attributes.overflow || &quot;auto&quot;; <br>            var markerFeature = new OpenLayers.Feature(this.layerToUse, location, data);<br>
            this.features.push(markerFeature);<br>            var marker = markerFeature.createMarker();<br>            if ((feature.attributes.title != null) <br>                &amp;&amp; (feature.attributes.description != null)) {<br>
              marker.events.register(&#39;click&#39;, markerFeature, this.markerClick);<br>            }<br>            if (this.layerToUse != null) {<br>                this.layerToUse.addMarker(marker);<br>            } else {<br>
                this.addMarker(marker);<br>            }<br><br><br>Also from my HTML file I call:<br><br>   
var new4 = new OpenLayers.Layer.Text( &quot;Texts&quot;, { layerToUse: markers,
newLat: &#39;4420851.767102&#39;, newLon: &#39;698762.34033203&#39;, newTitle: &quot;Test
Title 2&quot;, newDesc: &quot;This is a description 2&quot;} );<br>     new4.parseData();<br>
<br>
Instead of:<br>
<br>
   map.addLayer(new4);<br>
<br>
In summary, what this does is, it feeds specific layer, coords, title and description to the function.<br>
<br>
I also discovered a nice little bug. If you hide an overlay while a
marker bubble is open, the marker disappears while the bubble still
stays there. This also happens on the OL examples
(markersTextLayer.html).<br>
<br>
I hope I didn&#39;t go the long way around to solving this problem...<br><br><div class="gmail_quote">On Thu, Oct 8, 2009 at 3:29 PM, Christopher Schmidt <span dir="ltr">&lt;<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Thu, Oct 08, 2009 at 01:27:30PM +0300, Alex G. wrote:<br>
&gt; Hi all,<br>
&gt;<br>
&gt; I am interesting in constructing a function that places a marker with a<br>
&gt; bubble text as provided by OpenLayers.Layer.Text but I want to provide<br>
&gt; coordinates, title and description on the fly (without saving them to a file<br>
&gt; and then loading them to the function).<br>
&gt;<br>
&gt; I am using the OpenLayers example to catch clicks and then place a simple<br>
&gt; marker using markers.addMarker(new OpenLayers.Marker(new<br>
&gt; OpenLayers.LonLat(lonlat.lon,lonlat.lat),icon)); and everything seems to<br>
&gt; working fine.<br>
&gt;<br>
&gt; But I cannot seem to be able to figure out a way to do the same for<br>
&gt; OpenLayers.Layer.Text.<br>
<br>
</div>Er... It shouldn&#39;t be any different? Can you share your current code<br>
that isn&#39;t working?<br>
<br>
-- CHris<br>
<div class="im"><br>
&gt; I am guessing some heavy modification of Layer/Text.js is required? Is there<br>
&gt; maybe a patch around that could help me on this since my Javascript<br>
&gt; knowledge is pretty bad.<br>
&gt;<br>
&gt; Thanks in advance!<br>
<br>
</div>&gt; _______________________________________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
&gt; <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br>
</blockquote></div><br>