godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.6k stars 2.96k forks source link

CheckButton - link to example "How to use this control" #3806

Open monk-e-boy opened 3 years ago

monk-e-boy commented 3 years ago

Your Godot version: 3.2.2

Issue description: CheckButton - how the hell do you use it? How do you know if it is checked? The event does not pass in any kind of state.

URL to the documentation page (if already existing): https://docs.godotengine.org/en/stable/classes/class_checkbutton.html

Calinou commented 3 years ago

I'm not sure if we should add a code sample for literally every Control node out there. Not only it'd take up space in the description, but we'd also have to maintain lots of code samples which might end up being outdated in the long run.

How do you know if it is checked?

Like CheckBox, CheckButton inherits from BaseButton which has a pressed property.

The event does not pass in any kind of state.

The toggled signal in BaseButton has a button_pressed boolean.

akien-mga commented 3 years ago

https://docs.godotengine.org/en/stable/classes/class_checkbutton.html

Just to clarify, the class reference (all the API documentation in https://docs.godotengine.org/en/stable/classes/) is meant to describe the API of each Node from a scripting point of view, but not a general how-to for using nodes like e.g. how to connect signals to nodes in the Inspector. This is covered in the "Getting started" and "Tutorials" sections of the documentation.

But indeed, for CheckButton specifically, there's no specific howto currently.

If you haven't yet, I recommend reading the "Getting started" pages on building UI with (some) Controls: https://docs.godotengine.org/en/stable/getting_started/step_by_step/ui_introduction_to_the_ui_system.html https://docs.godotengine.org/en/stable/getting_started/step_by_step/ui_game_user_interface.html

It doesn't cover CheckButton, but the other buttons it covers function in a similar manner.

EhoNo1 commented 1 year ago

As someone in the process of learning Godot, this issue really needs addressed. Class reference is nice, but as it currently stands the CheckButton and CheckButton are frankly useless to learners without so much of a code snippet or any reference at all to a tutorial for actually using it.

A single line "To get the value of this checkbox use button_pressed." Is worth twice it's weight in gold to beginners who are still struggling to figure out what they are looking at.