-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Use RefreshItem to refresh an element in list #124
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package bridge | ||
|
||
import ( | ||
"fmt" | ||
"path/filepath" | ||
|
||
"fyne.io/fyne/v2" | ||
|
@@ -43,6 +44,7 @@ type SendData struct { | |
Client *transport.Client | ||
Window fyne.Window | ||
Canvas fyne.Canvas | ||
Uris []fyne.URI | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also seems like it shouldn't be here. |
||
|
||
items []*SendItem | ||
list *widget.List | ||
|
@@ -119,7 +121,7 @@ func (d *SendData) OnSelected(i int) { | |
d.items[len(d.items)-1] = nil // Allow the GC to reclaim memory. | ||
d.items = d.items[:len(d.items)-1] | ||
|
||
d.list.Refresh() | ||
d.list.RefreshItem(i) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here. We can't use RefreshItem() because we modify the whole slice. |
||
}} | ||
|
||
// Only allow failed or completed items to be removed. | ||
|
@@ -191,6 +193,20 @@ func (d *SendData) OnFileSelect(file fyne.URIReadCloser, err error) { | |
}() | ||
} | ||
|
||
func (d *SendData) OnMultiFilesSelect(file fyne.URIReadCloser, err error) { | ||
if err != nil { | ||
fyne.LogError("Error on selecting file to send", err) | ||
dialog.ShowError(err, d.Window) | ||
return | ||
} else if file == nil { | ||
return | ||
} | ||
|
||
fmt.Println("uris before:", d.Uris) | ||
d.Uris = append(d.Uris, file.URI()) | ||
fmt.Println("uris after:", d.Uris) | ||
} | ||
Comment on lines
+196
to
+208
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this supposed to be here? |
||
|
||
// OnDirSelect is intended to be passed as callback to a FolderOpen dialog. | ||
func (d *SendData) OnDirSelect(dir fyne.ListableURI, err error) { | ||
if err != nil { | ||
|
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'm sorry but this doesn't work. In this case we are changing the whole slice due to deletion and want to refresh everything.