MCPcopy Create free account
hub / github.com/lxn/walk / tryUpdateValue

Method tryUpdateValue

numberedit.go:650–668  ·  view source on GitHub ↗
(setText bool)

Source from the content-addressed store, hash-verified

648}
649
650func (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
670func (nle *numberLineEdit) selectNumber() {
671 nle.SetTextSelection(len(nle.prefix), len(nle.textUTF16())-len(nle.suffix))

Callers 2

processCharMethod · 0.95
WndProcMethod · 0.95

Calls 2

textUTF16Method · 0.95
setValueMethod · 0.95

Tested by

no test coverage detected