Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion declarative/lineedit.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type LineEdit struct {
OnEditingFinished walk.EventHandler
OnTextChanged walk.EventHandler
PasswordMode bool
PasswordChar rune
ReadOnly Property
Text Property
TextColor walk.Color
Expand Down Expand Up @@ -89,7 +90,15 @@ func (le LineEdit) Create(builder *Builder) error {
}
}
w.SetMaxLength(le.MaxLength)
w.SetPasswordMode(le.PasswordMode)
passwordMode := rune(0)
if le.PasswordMode {
if le.PasswordChar != 0 {
passwordMode = le.PasswordChar
} else {
passwordMode = -1
}
}
w.SetPasswordMode(passwordMode)

if err := w.SetCaseMode(walk.CaseMode(le.CaseMode)); err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions lineedit.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ func (le *LineEdit) PasswordMode() bool {
return le.SendMessage(win.EM_GETPASSWORDCHAR, 0, 0) != 0
}

func (le *LineEdit) SetPasswordMode(value bool) {
var c uintptr
if value {
func (le *LineEdit) SetPasswordMode(value rune) {
c := uintptr(value)
if value == -1 {
c = uintptr('*')
}

Expand Down