@@ -334,6 +334,12 @@ void TabBar::_shape(int p_tab) {
334
334
335
335
void TabBar::_notification (int p_what) {
336
336
switch (p_what) {
337
+ case NOTIFICATION_ENTER_TREE: {
338
+ if (scroll_to_selected) {
339
+ ensure_tab_visible (current);
340
+ }
341
+ } break ;
342
+
337
343
case NOTIFICATION_INTERNAL_PROCESS: {
338
344
Input *input = Input::get_singleton ();
339
345
@@ -1745,7 +1751,10 @@ void TabBar::_bind_methods() {
1745
1751
ADD_SIGNAL (MethodInfo (" tab_hovered" , PropertyInfo (Variant::INT, " tab" )));
1746
1752
ADD_SIGNAL (MethodInfo (" active_tab_rearranged" , PropertyInfo (Variant::INT, " idx_to" )));
1747
1753
1748
- ADD_PROPERTY (PropertyInfo (Variant::INT, " current_tab" , PROPERTY_HINT_RANGE, " -1,4096,1" , PROPERTY_USAGE_EDITOR), " set_current_tab" , " get_current_tab" );
1754
+ // "current_tab" property must come after "tab_count", otherwise the property isn't loaded correctly.
1755
+ ADD_ARRAY_COUNT (" Tabs" , " tab_count" , " set_tab_count" , " get_tab_count" , " tab_" );
1756
+
1757
+ ADD_PROPERTY (PropertyInfo (Variant::INT, " current_tab" , PROPERTY_HINT_RANGE, " -1,4096,1" ), " set_current_tab" , " get_current_tab" );
1749
1758
ADD_PROPERTY (PropertyInfo (Variant::INT, " tab_alignment" , PROPERTY_HINT_ENUM, " Left,Center,Right" ), " set_tab_alignment" , " get_tab_alignment" );
1750
1759
ADD_PROPERTY (PropertyInfo (Variant::BOOL, " clip_tabs" ), " set_clip_tabs" , " get_clip_tabs" );
1751
1760
ADD_PROPERTY (PropertyInfo (Variant::INT, " tab_close_display_policy" , PROPERTY_HINT_ENUM, " Show Never,Show Active Only,Show Always" ), " set_tab_close_display_policy" , " get_tab_close_display_policy" );
@@ -1756,8 +1765,6 @@ void TabBar::_bind_methods() {
1756
1765
ADD_PROPERTY (PropertyInfo (Variant::BOOL, " scroll_to_selected" ), " set_scroll_to_selected" , " get_scroll_to_selected" );
1757
1766
ADD_PROPERTY (PropertyInfo (Variant::BOOL, " select_with_rmb" ), " set_select_with_rmb" , " get_select_with_rmb" );
1758
1767
1759
- ADD_ARRAY_COUNT (" Tabs" , " tab_count" , " set_tab_count" , " get_tab_count" , " tab_" );
1760
-
1761
1768
BIND_ENUM_CONSTANT (ALIGNMENT_LEFT);
1762
1769
BIND_ENUM_CONSTANT (ALIGNMENT_CENTER);
1763
1770
BIND_ENUM_CONSTANT (ALIGNMENT_RIGHT);
0 commit comments