Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

matwachich
Copy link

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

    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
widget/completionentry.go Outdated Show resolved Hide resolved
Copy link
Member

@andydotxyz andydotxyz left a 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

go.mod Outdated Show resolved Hide resolved

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
Copy link
Member

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?

Copy link
Author

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.

item.parent.setTextFromMenu(item.parent.Options[item.id])
}

func (item *completionEntryListItem) MouseIn(_ *desktop.MouseEvent) { item.parent.list.Select(item.id) }
Copy link
Member

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.

Copy link
Author

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants