(setText bool)
| 648 | } |
| 649 | |
| 650 | func (nle *numberLineEdit) tryUpdateValue(setText bool) bool { |
| 651 | t := nle.textUTF16() |
| 652 | t = t[len(nle.prefix) : len(t)-len(nle.suffix)] |
| 653 | |
| 654 | text := strings.Replace(syscall.UTF16ToString(t), decimalSepS, ".", 1) |
| 655 | |
| 656 | switch text { |
| 657 | case "", ".": |
| 658 | text = "0" |
| 659 | } |
| 660 | |
| 661 | if value, err := strconv.ParseFloat(text, 64); err == nil { |
| 662 | if nle.minValue == nle.maxValue || value >= nle.minValue && value <= nle.maxValue { |
| 663 | return nle.setValue(value, setText) == nil |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | return false |
| 668 | } |
| 669 | |
| 670 | func (nle *numberLineEdit) selectNumber() { |
| 671 | nle.SetTextSelection(len(nle.prefix), len(nle.textUTF16())-len(nle.suffix)) |
no test coverage detected