mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-10 01:50:36 +08:00
Support multiple files in dialog
This commit is contained in:
parent
0ec6707263
commit
8666935caf
@ -416,7 +416,7 @@ char* OpenFileDialog(struct Application *app, char *title, char *filter) {
|
||||
|
||||
// OpenDialog opens a dialog to select files/directories
|
||||
// NOTE: The result is a string that will need to be freed!
|
||||
void OpenDialog(struct Application *app, char* callbackID, char *title, char *filter, int allowFiles, int allowDirs) {
|
||||
void OpenDialog(struct Application *app, char* callbackID, char *title, char *filter, int allowFiles, int allowDirs, int allowMultiple) {
|
||||
Debug("OpenDialog Called with callback id: %s", callbackID);
|
||||
|
||||
// Create an open panel
|
||||
@ -430,6 +430,7 @@ void OpenDialog(struct Application *app, char* callbackID, char *title, char *fi
|
||||
// TODO: Other options
|
||||
msg(dialog, s("setCanChooseFiles:"), allowFiles);
|
||||
msg(dialog, s("setCanChooseDirectories:"), allowDirs);
|
||||
msg(dialog, s("setAllowsMultipleSelection:"), allowMultiple);
|
||||
|
||||
msg(dialog, s("beginSheetModalForWindow:completionHandler:"), app->mainWindow, ^(id result) {
|
||||
|
||||
|
@ -6,4 +6,5 @@ type OpenDialog struct {
|
||||
Filter string
|
||||
AllowFiles bool
|
||||
AllowDirectories bool
|
||||
AllowMultiple bool
|
||||
}
|
||||
|
@ -98,6 +98,18 @@ func (r *RuntimeTest) OpenDialog(title string, filter string) []string {
|
||||
return r.runtime.Dialog.Open(dialogOptions)
|
||||
}
|
||||
|
||||
// OpenDialogMultiple will call the Runtime.Dialog.OpenDialog method allowing multiple selection
|
||||
func (r *RuntimeTest) OpenDialogMultiple(title string, filter string) []string {
|
||||
dialogOptions := &options.OpenDialog{
|
||||
Title: title,
|
||||
Filter: filter,
|
||||
AllowDirectories: true,
|
||||
AllowFiles: true,
|
||||
AllowMultiple: true,
|
||||
}
|
||||
return r.runtime.Dialog.Open(dialogOptions)
|
||||
}
|
||||
|
||||
// HideWindow will call the Runtime.Window.Hide method and then call
|
||||
// Runtime.Window.Show 3 seconds later.
|
||||
func (r *RuntimeTest) HideWindow() {
|
||||
|
Loading…
Reference in New Issue
Block a user