Show textbox only if $hd contains a description

Q&A about the latest versions
Post Reply
relativgut
Posts: 5
Joined: Tue Mar 28, 2023 11:29 am

This may be a stupid question but I couldn't find an answer. I have a textbox in an image popup that displays the hotspot description - but if there is no text in the description field I want the textbox to hide. I am trying a logic block on the textbox visibility to set it on false if the placeholder $(hd) is empty - but don't know how to write that. I tried $(hd) = and for value " " or just nothing at all and I doesn't do anything. Thanks for any hints.
User avatar
Hopki
Gnome
Posts: 13450
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

/// EDIT see the next post ///

Hi,
You were on the right track.
However, using the description placeholder only works if the text box is a child of the Point Hotspot.
The placeholder will only work when the mouse is over the hotspot, once it moves away it will lose connection.
So what you will need to do is use a Set Variable Action when the mouse is over the Hotspot so it is remembered once the mouse moves away.

Add a variable, say, vis_desc = false
Then to the description text box which has visible deselected, add a visible logic block.
*vis_desc, =, true, Visible: true

Then in the Hotspot add two actions:
Mouse Click, Set Variable Value, Set(=), true, vis_desc (action filter: hotspot description: $(hd), ≠, blank as in there is text in the description text box)
Mouse Click, Set Variable Value, Set(=), false, vis_desc (action filter: hotspot description: $(hd), =, blank as in no text)

This will then hide and show the description text box depending if it has text.
See the attached project.
Regards,
Attachments
project.zip
(17.11 KiB) Downloaded 33 times
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
User avatar
Hopki
Gnome
Posts: 13450
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
Had a rethink, here is a better version.
There is a text variable to which the point hotspot sets the description text.
Then the visibility of the text box depends on if there is content in the variable.
The text box uses the variable placeholder to display the text.
Much simpler and less actions, shaving a few lines of code from the skin.js file.
Regards,
Attachments
project_2.zip
(17.33 KiB) Downloaded 39 times
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
relativgut
Posts: 5
Joined: Tue Mar 28, 2023 11:29 am

Hi Hopki,
thanks for the quick answer and detailed explanation! Now it seems quite obvious that some textbox doesn't know anything about the hotspot's description :roll:
Thanks!
User avatar
Hopki
Gnome
Posts: 13450
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
I am not sure I understand your last comment.
The Hotspot Placeholders can only display the text while the mouse is over the hotspot.
So, you need a way of "setting" the text to a text box that will display it even after the mouse leaves the hotspot.
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
Post Reply