Open monk-e-boy opened 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.
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.
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.
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