Added note to used set_deferred while setting scroll values in _ready function.

(cherry picked from commit 83626ab90d)
This commit is contained in:
stmSi 2023-04-29 23:16:38 +06:30 committed by Rémi Verschelde
parent 42d2187f38
commit 96d658638a
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -47,12 +47,22 @@
</member> </member>
<member name="scroll_horizontal" type="int" setter="set_h_scroll" getter="get_h_scroll" default="0"> <member name="scroll_horizontal" type="int" setter="set_h_scroll" getter="get_h_scroll" default="0">
The current horizontal scroll value. The current horizontal scroll value.
[b]Note:[/b] If you are setting this value in the [method Node._ready] function or earlier, it needs to be wrapped with [method Object.set_deferred], since scroll bar's [member Range.max_value] is not initialized yet.
[codeblock]
func _ready():
set_deferred("scroll_horizontal", 600)
[/codeblock]
</member> </member>
<member name="scroll_horizontal_enabled" type="bool" setter="set_enable_h_scroll" getter="is_h_scroll_enabled" default="true"> <member name="scroll_horizontal_enabled" type="bool" setter="set_enable_h_scroll" getter="is_h_scroll_enabled" default="true">
If [code]true[/code], enables horizontal scrolling. If [code]true[/code], enables horizontal scrolling.
</member> </member>
<member name="scroll_vertical" type="int" setter="set_v_scroll" getter="get_v_scroll" default="0"> <member name="scroll_vertical" type="int" setter="set_v_scroll" getter="get_v_scroll" default="0">
The current vertical scroll value. The current vertical scroll value.
[b]Note:[/b] Setting it early needs to be deferred, just like in [member scroll_horizontal].
[codeblock]
func _ready():
set_deferred("scroll_vertical", 600)
[/codeblock]
</member> </member>
<member name="scroll_vertical_enabled" type="bool" setter="set_enable_v_scroll" getter="is_v_scroll_enabled" default="true"> <member name="scroll_vertical_enabled" type="bool" setter="set_enable_v_scroll" getter="is_v_scroll_enabled" default="true">
If [code]true[/code], enables vertical scrolling. If [code]true[/code], enables vertical scrolling.