Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ScrollContainer nodes under a TabContainer show warning messages #97233

Closed
Odiobill opened this issue Sep 20, 2024 · 3 comments · Fixed by #97291
Closed

Multiple ScrollContainer nodes under a TabContainer show warning messages #97233

Odiobill opened this issue Sep 20, 2024 · 3 comments · Fixed by #97291

Comments

@Odiobill
Copy link

Tested versions

  • Reproducible in 4.3.stable

System information

CachyOS Linux (Arch based), kernel 6.11.0-2-cachyos (64-bit)

Issue description

Adding multiple ScrollContainer nodes under a TabContainer shows yellow triangles with the warning message:

  • ScrollContainer is intended to work with a single child control.

The warning will appear for every ScrollContainer after the first one.

Screenshot_20240920_121644

Steps to reproduce

  • Create a new UI scene
  • Add a TabContainer node
  • Add a ScrollContainer node under the TabContainer
  • (expected) the ScrollContainer will show the warning because it doesn't have any child
  • Add any control node under the ScrollContainer
  • (expected) the warning will disappear
  • Duplicate the ScrollContainer, or add a new one with a single control child, to create another tab
  • Newly added (or duplicated) ScrollContainer nodes will keep showing the warning message

Minimal reproduction project (MRP)

N/A

@AThousandShips

This comment was marked as outdated.

@AThousandShips
Copy link
Member

This is caused by an oversight in the checks for the scroll container check:

PackedStringArray ScrollContainer::get_configuration_warnings() const {
PackedStringArray warnings = Container::get_configuration_warnings();
int found = 0;
for (int i = 0; i < get_child_count(); i++) {
Control *c = as_sortable_control(get_child(i));
if (!c) {
continue;
}
if (c == h_scroll || c == v_scroll) {
continue;
}
found++;
}
if (found != 1) {
warnings.push_back(RTR("ScrollContainer is intended to work with a single child control.\nUse a container as child (VBox, HBox, etc.), or a Control and set the custom minimum size manually."));
}
return warnings;
}

This should probably use: as_sortable_control(get_child(i), SortableVisbilityMode::VISIBLE);

CC @KoBeWi

@daveTheOldCoder
Copy link

daveTheOldCoder commented Nov 8, 2024

The warning messages were present in Godot 4.4-dev3, but are no longer present in 4.4-dev4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants