Sie sind nicht angemeldet.

1

Montag, 15. März 2010, 08:46

Possible bug? Textfield returning wrong "height" with autosize.

Hi there

I'm using autosize to set the size of a textfield, but it is displaying some strange behaviour: although the textfield IS resized and the text is shown, the background is not adjusted to its size.
This wouldn't be much of a problem, but when I try to access its "height", the value returned is that of the background, and not the entire text. I was trying to use this value to stop downscrolling when the text reaches the end. If I change the text size, the background is also resized, but still doesn't match. Any thoughts?


Here's the code for the textbox:

Quellcode

1
2
<plugin name="m_desc-box" url="plugins/textfield.swf" alpha="0.7"parent="m_desc-stubParent"visible="true"align="lefttop"    width="200" autosize="left"wordwrap="true"y="0"background="true"
css="data:m_desc-textCSS"html="data:m_desc-roomDescription"zorder="1"/>


And a couple of example results:

Values traced:
get(plugin[m_desc-box].height) = 289

stageHeight = 500




Values traced:
get(plugin[m_desc-box].height) = 124

stageHeight = 500

Thanks
Manuel
PanoTag: Facebook tagging for krpano

KRPano development and more: http://www.digisfera.pt/en/development

2

Montag, 15. März 2010, 16:57

I have the same problem, but not using a scrollbar.

3

Montag, 15. März 2010, 20:00

Fixed!

I noticed that when I changed the displayed text after a while, then the size was correct. So I fixed it by removing the "html=..." on the plugin declaration and replacing it by:

onloaded="delayedcall(0.01,set(html,data:m_desc-roomDescription))"


Hope it helps!
PanoTag: Facebook tagging for krpano

KRPano development and more: http://www.digisfera.pt/en/development

4

Mittwoch, 17. März 2010, 10:11

Hi,

do you have an online example for that?
I wanted try to fix it but I can't reproduce it...

best regards,
Klaus

5

Sonntag, 21. März 2010, 15:07

Hey

The problem can be seen in this very simple example:

Zitat


<krpano version="1.0.8">
<plugin name="m_desc-box" url="textfield.swf"
align="lefttop"
width="200"
autosize="left"

background="true"
html="This is the text bla bla bla bla bla bla bla bla bla bla bla blabla bla bla bla bla blabla bla bla bla bla blabla bla bla bla

bla blabla bla bla bla bla blabla bla bla bla bla blabla bla bla bla bla And this is the end of it!"
/>
</krpano>
In 1.0.8 beta 9, all the text is displayed (it can be seen when you select it), but the background only has around half the size of the text. Let me know if you can't reproduce the problem with this.

Thanks
PanoTag: Facebook tagging for krpano

KRPano development and more: http://www.digisfera.pt/en/development

6

Sonntag, 21. März 2010, 16:12

Hi emediquei,

Following the way you already fixes the autosize problem *thumbup* , I found that your code above can be fixed also in this way:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<krpano version="1.0.8">
<plugin name="m_desc-box" url="textfield.swf"
align="lefttop"
width="200"
autosize="left"
onloaded="set(html,get(html))"
background="true"
html="This is the text bla bla bla bla bla bla bla
bla bla bla bla blabla bla bla bla bla blabla bla bla bla bla blabla
bla bla bla
onloaded="set(html,get(html))"
bla blabla bla bla
bla bla blabla bla bla bla bla blabla bla bla bla bla And this is the
end of it!"
/>
</krpano> 

onloaded="set(html,get(html))" without the delayedcall()...

SAlut.

7

Sonntag, 2. Mai 2010, 01:49

but.... in other html code

Hi..

great solution, but a question,
if in the html data i have a code of image

Quellcode

1
html="blabla bla bla  <img src="hello.jpg" /> bla bla"



this not work ,because de quotes

how write this??

thanks!!

8

Sonntag, 2. Mai 2010, 22:22

Hi mnovoa,

Zitat

this not work ,because de quotes
Not only because the quotes... also because the < and /> used inside the html attribute...
Have a look to the Textfield html attribute :
HTML code
write direct HTML code, but NOTE - using HTML chars like '<' and '>' is not possiblie, because of XML limitations, so you can use '[' and ']' instead!
So your code will be:

Quellcode

1
html="blabla bla bla [img src='hello.jpg' /] bla bla"

Also, have a look to this thread: Disabling image text wrap

Hope this help.

SAlut.

9

Freitag, 4. März 2011, 14:04

I've also struggled with this, and had to resolve it by a combination of delaying changing the .html, and forcing a redraw with lookto( get(view.hlookat), get(view.vlookat)); There was different behaviour on Mac from Windows (Win got the height wrong consistently unless there was a delay)

Would it be better if instead of setting a property on the textfield component, there was a changehtml method which would definitely change the HTML, AND then internally force the autosize to recalculate?

Ähnliche Themen