I was looking for an answer to this some time ago and didn't find anything, so here's my solution.
The problem:
When we use the InputText plugin to allow the user to enter some value, it is possible that the user mistakenly/knowingly leaves it empty and hits enter. What happens is that the meter that displays that value will disappear, making any other meter which position is relative to that meter move.
Example: In the next code, we have a shape meter and 2 string meters, one called title and another subtitle. You can enter a Title and a subtitle by clicking them, typing and then hitting enter.
This works great, but if you leave Title empty and hit enter, Tittle will disappear and Subtitle will move up.
We just add Substitute="":"DefaultValue" to the InputText measures. Not that easy tho, if you only do that, nothing will change, because we don't use the value of the measure to set the variable, only to write it, we use $UserInput$ to set the variable. It would only go back to the default value after a refresh. To fix it, we'll add another SetVariable bang like this:
Before:
[!SetVariable Subtitle "$UserInput$"][!WriteKeyValue Variables Subtitle "[#CurrentSection#]"][!Update][!Redraw]
After:
[!SetVariable Subtitle "$UserInput$"][!SetVariable Subtitle "[#CurrentSection#]"][!WriteKeyValue Variables Subtitle "[#CurrentSection#]"][!Update][!Redraw]
This will overwrite the $UserInput$ value with the value of the measure with our substitution (If we don't use $UserInput$ at all the Plugin won't work).
So now, after adding those changes to both measures our code looks like this: And done, now when we leave them empty, the values return to our set default values, in this case, "Title" and "Subtitle".
The problem:
When we use the InputText plugin to allow the user to enter some value, it is possible that the user mistakenly/knowingly leaves it empty and hits enter. What happens is that the meter that displays that value will disappear, making any other meter which position is relative to that meter move.
Example: In the next code, we have a shape meter and 2 string meters, one called title and another subtitle. You can enter a Title and a subtitle by clicking them, typing and then hitting enter.
To avoid this we can use substitute.
We just add Substitute="":"DefaultValue" to the InputText measures. Not that easy tho, if you only do that, nothing will change, because we don't use the value of the measure to set the variable, only to write it, we use $UserInput$ to set the variable. It would only go back to the default value after a refresh. To fix it, we'll add another SetVariable bang like this:
Before:
[!SetVariable Subtitle "$UserInput$"][!WriteKeyValue Variables Subtitle "[#CurrentSection#]"][!Update][!Redraw]
After:
[!SetVariable Subtitle "$UserInput$"][!SetVariable Subtitle "[#CurrentSection#]"][!WriteKeyValue Variables Subtitle "[#CurrentSection#]"][!Update][!Redraw]
This will overwrite the $UserInput$ value with the value of the measure with our substitution (If we don't use $UserInput$ at all the Plugin won't work).
So now, after adding those changes to both measures our code looks like this:
Any other workaround is welcomed.
Statistics: Posted by RicardoTM — Today, 12:10 am — Replies 0 — Views 14