docs: standardize and expand documentation for all widgets with constructors, methods, and examples.#14
Conversation
…ructors, methods, and examples.
There was a problem hiding this comment.
Code Review
This pull request significantly expands the documentation for the php-gui library, providing detailed guides for all widgets including constructors, configuration options, code examples, and method references. It also introduces a 'Common Behaviours' page to centralize information on layout managers and shared styling. The review feedback identifies critical issues where the documentation describes functionality that is currently broken in the underlying PHP implementation, specifically regarding space-separated values in Comboboxes and text handling in Canvas drawings. Additionally, a correction was provided to remove an incorrect reference to a 'command' option in the Input widget documentation.
|
|
||
| | Key | Type | Description | | ||
| |----------|----------|--------------------------------------------------------------------------------------| | ||
| | `values` | `string` | **Space-separated** list of items shown in the dropdown. Defaults to `''` (empty). | |
There was a problem hiding this comment.
The documentation for the values option (here and in the 'Notes' section on line 62) is misleading. It states that a space-separated string will create multiple items, but the current implementation in Combobox.php will treat the entire string as a single item. This is due to incorrect quoting in the Tcl command (-values {{$values}} instead of -values {$values}).
As a result, the widget does not function as described for its primary use case. For this documentation to be accurate, the underlying code in Combobox.php must be fixed.
|
|
||
| ### Notes | ||
|
|
||
| - `drawText()` uses `-text {text}` so the text string is passed as a Tk list element — it can contain spaces. |
There was a problem hiding this comment.
This note is incorrect. It claims that drawText() handles spaces because the text is passed as a Tk list element. However, the implementation in Canvas.php (... -text {$text} ...) does not quote the text, which will cause an error if the text contains spaces.
For the documentation to be correct, the implementation needs to be changed to properly quote the text for Tcl, for example: ... -text {{$text}} .... As it is, this part of the documentation describes a feature that is broken.
| | `font` | `string` | Font string, e.g. `'Arial 14'`. | | ||
| | `show` | `string` | If set to `'*'`, masks characters (useful for password fields). | | ||
|
|
||
| Any option other than `text` and `command` is forwarded as a Tk `-key "value"` pair to the underlying `entry` command. |
There was a problem hiding this comment.
The Input widget does not handle a command option; it uses the onEnter() method for event handling. This sentence seems to be a leftover from another widget's documentation and could be confusing. Please remove the reference to command.
| Any option other than `text` and `command` is forwarded as a Tk `-key "value"` pair to the underlying `entry` command. | |
| Any option other than `text` is forwarded as a Tk `-key "value"` pair to the underlying `entry` command. |
No description provided.