-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite of CompletionEntry #60
base: master
Are you sure you want to change the base?
Conversation
simplified code support variable height items first item automatically selected items are selected on hover and remplaced on Tap or Enter Added completion_demo to cmd Changed fyne version to latest (2.3.4) in go.mod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. Not sure about a few things inline
|
||
Options []string | ||
OnCompleted func(string) string // Called when you select an item from the list ; return different string to override the completion | ||
SubmitOnCompleted bool // True will call Entry.OnSubmited when you select a completion item |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this needs to be optional? The OnSubmitted
call is already optional, so this is kinda doubled up and could just always on can't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OnComplete is important to eventually modifiy the string to be inserted in the Entry.
Imagine what is stored in Options is not exactly what should be inserted in Entry...(*)
SubmitOnComplete is for when we want OnSubmitted to be called uppon completion. We could manually call OnSubmitted inside OnComplete but imagine we are in the case above (*), when in OnComplete the Entry content is not yet right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for letting this drop - I guess I didn't understand the use-case. Both the list and the Entry are user facing, so why should what is input not match what is selected?
p.s. "Completed" is misleading here - It means the action is finished but when you select an item you are not necessarily "done" - Other widgets use different verbs to indicate that a menu item is selected / actioned.
widget/completionentry.go
Outdated
item.parent.setTextFromMenu(item.parent.Options[item.id]) | ||
} | ||
|
||
func (item *completionEntryListItem) MouseIn(_ *desktop.MouseEvent) { item.parent.list.Select(item.id) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not OK that this only happens on desktop instance.
I can't see how mobile apps will be able to select an item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will just select an item to show it selected on hover, item completion is not triggered by list.Select, but by item Tapped
Removed desktop-only features (select on hover)
Hi, any updates on this? I have my own fix for the popupMenu (re)sizing as it's currently broken. This PR also seems to fix at least the size calculation issue so would be nice if it gets merged. |
I'm not really working on this PR anymore, but for my project I use matwachich/fynex-widgets AutoComplete entry widget and it works like a charm! |
Thanks for the quick reply. I have followed up with #95 |
Sorry that nobody got to reviewing this before. |
simplified code
support variable height items
first item automatically selected
items are selected on hover and remplaced on Tap or Enter
Tests pass
Added completion_demo to cmd
Changed fyne version to latest (2.3.4) in go.mod