5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-09 08:00:13 +08:00

[v3 windows] Dialogs to use invokeSync

This commit is contained in:
Lea Anthony 2023-05-08 20:11:51 +10:00
parent c8dae94b5b
commit a829b38a34
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
2 changed files with 59 additions and 61 deletions

View File

@ -100,7 +100,7 @@ func (d *MessageDialog) Show() {
if d.impl == nil {
d.impl = newDialogImpl(d)
}
d.impl.show()
invokeSync(d.impl.show)
}
func (d *MessageDialog) SetIcon(icon []byte) *MessageDialog {
@ -248,7 +248,7 @@ func (d *OpenFileDialog) PromptForSingleSelection() (string, error) {
if d.impl == nil {
d.impl = newOpenFileDialogImpl(d)
}
selection, err := d.impl.show()
selection, err := invokeSyncWithResultAndError(d.impl.show)
var result string
if len(selection) > 0 {
result = selection[0]
@ -272,7 +272,7 @@ func (d *OpenFileDialog) PromptForMultipleSelection() ([]string, error) {
if d.impl == nil {
d.impl = newOpenFileDialogImpl(d)
}
return d.impl.show()
return invokeSyncWithResultAndError(d.impl.show)
}
func (d *OpenFileDialog) SetMessage(message string) *OpenFileDialog {
@ -412,7 +412,7 @@ func (d *SaveFileDialog) PromptForSingleSelection() (string, error) {
if d.impl == nil {
d.impl = newSaveFileDialogImpl(d)
}
return d.impl.show()
return invokeSyncWithResultAndError(d.impl.show)
}
func (d *SaveFileDialog) SetButtonText(text string) *SaveFileDialog {

View File

@ -13,7 +13,6 @@ type windowsDialog struct {
}
func (m *windowsDialog) show() {
globalApplication.dispatchOnMainThread(func() {
//
//// Mac can only have 4 Buttons on a dialog
//if len(m.dialog.Buttons) > 4 {
@ -69,7 +68,6 @@ func (m *windowsDialog) show() {
// }
//}
panic("implement me")
})
}