Script widget - traversalOn woes [SOLVED]
Posted: Mon Dec 18, 2023 3:32 am
Hi all,
I'm hoping someone with experience in script widgets or LCB widgets may be able to provide some insight...
Based on a group control I recently posted, I'm creating a script widget that acts as a field with placeholderText that optionally appears/disappears with animation and optionally can be used as a password field that hides/unhides text with bullet points.
So far this works fabulously. but I hit one snag I can't seem to work around: traversalOn. Not being able to tab in or out of this field is obviously a major issue.
The code is available here: https://github.com/stam66/placeholderField (MIT licence)
For some reason the default traversalOn of the widget is false (i.e. can't tab in or out of this). ]
I can set it to true quite easily with the messageBox and like magic tabbing in and out is as expected.
However, I can't seem to be able to set the traversalOn with the script of the script widget itself, or modify it with the property inspector as I would expect.
Or, more correctly, I found one way to set this, but it stops the widget from rendering (until it's resized).
I have a widget property: widgetTraversalOn with getter and setter handlers. The setter sets the boolean value and calls updateVisualControls (which sets all the relevant properties). In this handler, the line:works, Inasmuch as the traversalOn of the generated widget in the extension builder's test stack is true (the default value for widgetTraversalOn), but the widget renders topLeft (instead of middle of the stack), with no visible elements (which wasn't the case previously).
It remains selectable and if resize it, it draws normally and after this works normally.
If I put code above anywhere else (eg directly in the setter, a separate command, send in time, etc), the widget renders normally:
but the traversalOn for the widget is false and can't be set with the property inspector (although the widget's property wigetTraversalOn is set) so tabbing in/out can't happen, which is highly undesirable.
After a couple of hours at this last seemingly tiny hurdle I'm not sure I can think of anything else...
Any suggestions?
many thanks
Stam
I'm hoping someone with experience in script widgets or LCB widgets may be able to provide some insight...
Based on a group control I recently posted, I'm creating a script widget that acts as a field with placeholderText that optionally appears/disappears with animation and optionally can be used as a password field that hides/unhides text with bullet points.
So far this works fabulously. but I hit one snag I can't seem to work around: traversalOn. Not being able to tab in or out of this field is obviously a major issue.
The code is available here: https://github.com/stam66/placeholderField (MIT licence)
For some reason the default traversalOn of the widget is false (i.e. can't tab in or out of this). ]
I can set it to true quite easily with the messageBox and like magic tabbing in and out is as expected.
However, I can't seem to be able to set the traversalOn with the script of the script widget itself, or modify it with the property inspector as I would expect.
Or, more correctly, I found one way to set this, but it stops the widget from rendering (until it's resized).
I have a widget property: widgetTraversalOn with getter and setter handlers. The setter sets the boolean value and calls updateVisualControls (which sets all the relevant properties). In this handler, the line:
Code: Select all
set the traversalOn of me to the widgetTraversalOn of me
It remains selectable and if resize it, it draws normally and after this works normally.
If I put code above anywhere else (eg directly in the setter, a separate command, send in time, etc), the widget renders normally:
but the traversalOn for the widget is false and can't be set with the property inspector (although the widget's property wigetTraversalOn is set) so tabbing in/out can't happen, which is highly undesirable.
After a couple of hours at this last seemingly tiny hurdle I'm not sure I can think of anything else...
Any suggestions?
many thanks
Stam