open3d::visualization::gui::NumberEdit SetLimits() and SetDecimalPrecision() don't affect OnValueChanged callback
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).
### Describe the issue
The `SetLimits()` function set the min and max, and adjusts the value of the current value. However, if the user changed the variable in the widget, these limits are ignored, both for the display of the variable, and in a user-specified callback.
A similar thing is observed for the SetDecimalPrecision() function - the value sent to the user-defined callback has as much precision as the user entered.
Looking at the code, https://github.com/isl-org/Open3D/blob/master/cpp/open3d/visualization/gui/NumberEdit.cpp, indeed the min_value_ and max_value_ variables aren't being used to constrain the value of the user-entered variable, and num_decimal_digits_ is only being used for display.
### Steps to reproduce the bug
```python
1. Create a NumberEdit widget
2. Call the SetOnValueChanged() function to any callback, e.g. print value to console
3. Call the SetLimits() function (and SetDecimalPrecision() function)
4. Compile, run, and type a number into the NumberEdit box outside of the limits, or with more decimal precision than specified.
You will see that whatever was typed into the box is what is sent to the callback.
```
### Error message
_No response_
### Expected behavior
SetLimits() should set the limits of the value both in the displayed number, and in the value sent to the user callback.
SetDecimalPrecision() should set the precision of the value sent to the user callback.
### Open3D, Python and System information
```markdown
- Operating system: Ubuntu 20.04
- Python version: Python 3.8 / output from `import sys; print(sys.version)`
- Open3D version: output from python: `print(open3d.__version__)`
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: built master from source
- Compiler version (if built from source): gcc 9.4
```
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.