You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the values of widget form components can (usually) only be changed by a user, not by AiScript code.
For some components, such as textInput, calling .update({default: <new value>}) will change the value. However, this does not work for some other components, such as select, and it seems to be an un-intentional side-effect of setting the default value, rather than an intentional feature.
It would be nice to have an intentional method to set the value of the component at runtime, such as .update({value: <new value>}).
Purpose
Example 1: My widget uses a Ui:C:textInput component. When a button is pressed, I want to clear the text from the component, allowing the user to input new text easily. I can currently do this by changing default with .update(), but this behavior is undocumented, and likely unintended. Adding a new method to do this would help widget developers by giving a clear, documented method to change values at runtime.
Example 2: My widget uses a Ui:C:select component. When a button is pressed, the items in the select component are updated programmatically using .update({items: [...]}). However, there is no way to automatically select one of the new items. The component continues to display the currently selected item, even though that item no longer exists. If there were a way to set the selected value programmatically, this would allow the widget to select an item from the new list to display.
Do you want to implement this feature yourself?
Yes, I will implement this by myself and send a pull request
The text was updated successfully, but these errors were encountered:
Summary
Currently, the values of widget form components can (usually) only be changed by a user, not by AiScript code.
For some components, such as
textInput
, calling.update({default: <new value>})
will change the value. However, this does not work for some other components, such asselect
, and it seems to be an un-intentional side-effect of setting the default value, rather than an intentional feature.It would be nice to have an intentional method to set the value of the component at runtime, such as
.update({value: <new value>})
.Purpose
Example 1: My widget uses a
Ui:C:textInput
component. When a button is pressed, I want to clear the text from the component, allowing the user to input new text easily. I can currently do this by changingdefault
with.update()
, but this behavior is undocumented, and likely unintended. Adding a new method to do this would help widget developers by giving a clear, documented method to change values at runtime.Example 2: My widget uses a
Ui:C:select
component. When a button is pressed, the items in theselect
component are updated programmatically using.update({items: [...]})
. However, there is no way to automatically select one of the new items. The component continues to display the currently selected item, even though that item no longer exists. If there were a way to set the selected value programmatically, this would allow the widget to select an item from the new list to display.Do you want to implement this feature yourself?
The text was updated successfully, but these errors were encountered: