Connecting Tech Pros Worldwide Help | Site Map

text:wrap not working when created dynamically

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 24th, 2005, 03:25 PM
mike
Guest
 
Posts: n/a
Default text:wrap not working when created dynamically

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, 06:55 PM
Randy Webb
Guest
 
Posts: n/a
Default 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, 10:35 PM
mike
Guest
 
Posts: n/a
Default Re: text:wrap not working when created dynamically

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

  #4  
Old July 24th, 2005, 11:55 PM
mike
Guest
 
Posts: n/a
Default 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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.