Explorar o código

Merge pull request #55609 from rcorre/doc-scroll

Rémi Verschelde %!s(int64=3) %!d(string=hai) anos
pai
achega
26510f4c90
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      doc/classes/ScrollContainer.xml

+ 6 - 0
doc/classes/ScrollContainer.xml

@@ -16,6 +16,12 @@
 			<argument index="0" name="control" type="Control" />
 			<argument index="0" name="control" type="Control" />
 			<description>
 			<description>
 				Ensures the given [code]control[/code] is visible (must be a direct or indirect child of the ScrollContainer). Used by [member follow_focus].
 				Ensures the given [code]control[/code] is visible (must be a direct or indirect child of the ScrollContainer). Used by [member follow_focus].
+				[b]Note:[/b] This will not work on a node that was just added during the same frame. If you want to scroll to a newly added child, you must wait until the next frame using [signal SceneTree.process_frame]:
+				[codeblock]
+				add_child(child_node)
+				await get_tree().process_frame
+				ensure_control_visible(child_node)
+				[/codeblock]
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="get_h_scrollbar">
 		<method name="get_h_scrollbar">