Sie sind nicht angemeldet.

martinlbb

Anfänger

  • »martinlbb« ist der Autor dieses Themas

Beiträge: 11

Wohnort: France

Beruf: Pro photographer

  • Nachricht senden

1

Dienstag, 8. November 2011, 22:20

[Solved + 1.0.8.14minor fix] Using single quote within showtext inside a set function

Depending on user imput, I'm changing onhover caption, using a call to set function like this:

Quellcode

1
set(hotspot[myspot].onhover, showtext('Some text',mystyle));


And then, some moment later, I will call this to change text:

Quellcode

1
set(hotspot[myspot].onhover, showtext('NEW TEXT',mystyle));


This work well with text formatting (italic, bold, underline, line break) and quote (encoded as "), but I didn't find any way to insert a quote within this text.

Trying theses will fail:

Quellcode

1
2
3
4
5
set(hotspot[myspot].onhover, showtext('My brother's test',mystyle));
set(hotspot[myspot].onhover, showtext(My brother's test,mystyle));
set(hotspot[myspot].onhover, showtext("My brother's test",mystyle));
set(hotspot[myspot].onhover, showtext("My brother%39s test",mystyle));
set(hotspot[myspot].onhover, showtext("My brother's test",mystyle));


Any ideas ? *confused*

Thanks!
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »martinlbb« (20. Dezember 2011, 22:02)


Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

2

Freitag, 11. November 2011, 11:29

<action name="something">
set(hotspot[myspot].onhover, showtext("My brother's test",mystyle));
</action>

should work

else use:

& #39; (without the space between & and #)

not %39

martinlbb

Anfänger

  • »martinlbb« ist der Autor dieses Themas

Beiträge: 11

Wohnort: France

Beruf: Pro photographer

  • Nachricht senden

3

Freitag, 11. November 2011, 13:07

Thanks for you reply.

Yes, adding double quote should work, but only when modifying one item at a time. Same if you are using HTML encoded chars (&#charvalue;).

If you want to modify severals items in the same functions, then it fail.

I did a test tour, available here: http://www.martinloyer.fr/sharing/krpano/demo.html

You can look here XML : http://www.martinloyer.fr/sharing/krpano/demo.xml

It's fairly simple. V1 button will update only one item (button itself), while V2 button will try to update V1 and V2 captions.
V1 button work well while V2 button just fail.

Any ideas ?
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

martinlbb

Anfänger

  • »martinlbb« ist der Autor dieses Themas

Beiträge: 11

Wohnort: France

Beruf: Pro photographer

  • Nachricht senden

4

Montag, 19. Dezember 2011, 13:03

Up...!

Problem is still here :(

Klaus, any idea?
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

5

Montag, 19. Dezember 2011, 16:03

That happens because you are using single quotes in the content of the action.. which causes it to parse incorrectly. Please escape it as everyone has already said.

Try

Quellcode

1
2
3
4
5
6
7
	<action name="modify_more_caption">
		showlog(true);
		trace('V2 function launched. Howewever, V1 caption nor V2 caption are updated... :(');
		trace('You should read V2 TEST OK on both buttons....');
		set(hotspot[button].onhover, showtext("V2 TEST OK: My brother&amp;#39;s caption",defaultstyle));
		set(hotspot[button].onhover, showtext("V2 TEST OK: My caption&amp;#39;s brother",defaultstyle));
	</action>
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

martinlbb

Anfänger

  • »martinlbb« ist der Autor dieses Themas

Beiträge: 11

Wohnort: France

Beruf: Pro photographer

  • Nachricht senden

6

Montag, 19. Dezember 2011, 16:24

Many thanks sachagriffin, your answer solved it.

However, the single post from Zephyr suggested to use ampersand with decimal value as used in HTML, but it don't work.
Example below:

Quellcode

1
&39;


Or to use % with decimal value (coming from Krpano documentation, located here : http://krpano.com/docu/actions/#showtext )
Example below:

Quellcode

1
% 39  (without space)


You are using a different way, using an HTML written ampersand (&amp;) with an hash and decimal value.
Example below :

Quellcode

1
&amp;#39;


From now, I never saw it in KrPano documentation, or even on showtext function :(
It may help other developer to had this useful information on KrPano. That was the primary idea of this post.

PS: Zephir, you are lucky, now you are everyone *g*
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

7

Montag, 19. Dezember 2011, 16:46

Showtext is kinda strange in this way.
This issue actually comes up fairly frequently.
Here's a link to the last post in August.
showtext single-quote or apostrophe issues
Usually you can save a ton of time debugging by searching for the issue in various keyword combinations.
Nice clean example though.
Some people post thousand line chunks of code when all they needed was one or two and/or links to tours that contain about a zillion nested includes.. No one but a saint has time to troubleshoot this type of stuff.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

martinlbb

Anfänger

  • »martinlbb« ist der Autor dieses Themas

Beiträge: 11

Wohnort: France

Beruf: Pro photographer

  • Nachricht senden

8

Montag, 19. Dezember 2011, 17:14

Showtext is kinda strange in this way. http://www.1001photographes.com/annuaire…665&PREVIEW=OUI
Sure :/


This issue actually comes up fairly frequently.
Here's a link to the last post in August.
showtext single-quote or apostrophe issues

Sorry to hear about that. But I did forum search before, Krpano doc and even Hoogle crawling before. Unlucky :(



Usually you can save a ton of time debugging by searching for the issue in various keyword combinations.

I did :) For me, using ampersand coded in HTML was to weird to be accepted by XML parser. I was wrong...

No one but a saint has time to troubleshoot this type of stuff.

Sure, I also helps on other forum, and it's always the same 'way of life'.

Thanks for your help. I hope documentation will be updated, to avoid such posting ;)
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

9

Montag, 19. Dezember 2011, 17:25

I've also ranted enough about these issues. There are some that are MUCH harder to figure out than showtext, like needing to use %%27 to escape a split double quote. I think Klaus finally agrees that there is a lot of problems in this area, and he is thinking about adding some supported
escape() unescape() functions for the next version and yes there isn't really any documentation for these special characters and when they need to be used except for forum posts.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

10

Dienstag, 20. Dezember 2011, 11:59

Hi,

just a quick note - this issue will be fixed in the next release,

best regards,
Klaus

martinlbb

Anfänger

  • »martinlbb« ist der Autor dieses Themas

Beiträge: 11

Wohnort: France

Beruf: Pro photographer

  • Nachricht senden

11

Dienstag, 20. Dezember 2011, 21:28

Thanks Klaus!

@sachagriffin: thanks for your %%27 tips ;)
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

12

Dienstag, 20. Dezember 2011, 21:58

Hi,

here the fixed release:
krpano 1.0.8.14

best regards,
Klaus

martinlbb

Anfänger

  • »martinlbb« ist der Autor dieses Themas

Beiträge: 11

Wohnort: France

Beruf: Pro photographer

  • Nachricht senden

13

Dienstag, 20. Dezember 2011, 22:01

Quick fix!

Thanks Klauss!

I test it and let forum now.
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

14

Mittwoch, 21. Dezember 2011, 01:46

So does that mean we can now use raw single quotes in a double quote?
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

martinlbb

Anfänger

  • »martinlbb« ist der Autor dieses Themas

Beiträge: 11

Wohnort: France

Beruf: Pro photographer

  • Nachricht senden

15

Mittwoch, 21. Dezember 2011, 10:43

So does that mean we can now use raw single quotes in a double quote?


Yes :)

I tested it this morning, with minor bug-fixe version.

Available at the same test address: http://www.martinloyer.fr/sharing/krpano/demo.html

Thanks Klaus!
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/