Connecting Tech Pros Worldwide Help | Site Map

text:wrap not working when created dynamically

  #1  
Old July 24th, 2005, 04:25 PM
mike
Guest
 
Posts: n/a
I have a script that is not rendering the textwrap in svg properly.
//does not work .....
var svgLand = svgObj.getElementById("NarrDisplay");
mytextwrap=
document.createElement("text:wrap"); mytextwrap.setAttribute("x","20");
mytextwrap.setAttribute("y","30");
mytextwrap.setAttribute("width","640");
mytextwrap.setAttribute("style","fill:#000000; font-family:arial;
font-size:14; text-align:left; line-interval:1.25em;");
mytext=document.createTextNode("something here");
mytextwrap.appendChild(mytext);
svgLand.appendChild(mytextwrap);


//works ....
mynorm_text = document.createElement("text");
mynorm_text.setAttribute("x","30");
mynorm_text.setAttribute("y","90");
mynorm_text.setAttribute("style","fill:#000000; font-family:arial;
font-size:14; text-align:left;");
mytext=document.createTextNode("something here");
mynorm_text.appendChild(mytext);
svgLand.appendChild(mynorm_text);

It works when I use this statically:
<text:wrap id="NarrText" x="20" y="30" width="640" style="fill:#000000;
font-family:arial; font-size:14; text-align:left;
line-interval:1.25em;">default text</text:wrap>

Any help appreciated.

Mike

  #2  
Old July 24th, 2005, 07:55 PM
Randy Webb
Guest
 
Posts: n/a

re: text:wrap not working when created dynamically


mike said the following on 7/24/2005 11:20 AM:
[color=blue]
> I have a script that is not rendering the textwrap in svg properly.
> //does not work .....
> var svgLand = svgObj.getElementById("NarrDisplay");
> mytextwrap=
> document.createElement("text:wrap");[/color]
[color=blue]
> mytextwrap.setAttribute("x","20");[/color]


mytextwrap.x = "20";
[color=blue]
> mytextwrap.setAttribute("y","30");[/color]

mytextwrap.y = "30";

And so on. Meaning, don't use setAttribute, just set the properties
directly.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
  #3  
Old July 24th, 2005, 11:35 PM
mike
Guest
 
Posts: n/a

re: text:wrap not working when created dynamically


No change ........ same thing...... does not work.

  #4  
Old July 25th, 2005, 12:55 AM
mike
Guest
 
Posts: n/a

re: text:wrap not working when created dynamically


I got it. textwrap.es has some functions with the object.

So after i created the static textwrap instance:

<text:wrap id="NarrText" x="20" y="30" width="640" style="fill:#000000;

font-family:arial; font-size:14; text-align:left;
line-interval:1.25em;">default text</text:wrap>

I can use:
var text = TextWrap._instances[0];
text.setString(task_text);

and it will change the text.

see textwrap.es

Mike

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT? My First Working Modification of C++ Example Code, under QT. :-D Rich Grise answers 7 February 4th, 2006 04:35 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 11:37 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 09:56 PM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit answers 0 November 13th, 2005 03:15 AM