best-agent-85158
05/16/2022, 10:29 AMbest-agent-85158
05/16/2022, 10:30 AMbest-agent-85158
05/16/2022, 10:30 AMbright-gpu-74537
05/16/2022, 10:38 AMbright-gpu-74537
05/16/2022, 10:38 AMbest-agent-85158
05/16/2022, 10:44 AMbest-agent-85158
05/16/2022, 10:45 AMicy-zebra-52882
05/16/2022, 11:05 AMhx.widgets.FileDialog, didn't realise at the time that there is haxe.ui.containers.dialogs.SelectFileDialogicy-zebra-52882
05/16/2022, 11:06 AMbright-gpu-74537
05/16/2022, 11:07 AMicy-zebra-52882
05/16/2022, 11:08 AMicy-zebra-52882
05/16/2022, 11:08 AMbright-gpu-74537
05/16/2022, 11:09 AMhaxe.ui.containers.dialogs.Dialogs.selectFilebright-gpu-74537
05/16/2022, 11:09 AMbright-gpu-74537
05/16/2022, 11:09 AMhaxe
public static function selectFile(callback:DialogButton->Array<SelectedFileInfo>->Void, options:SelectFileDialogOptions = null) {
var dialog = new SelectFileDialog();
dialog.callback = callback;
dialog.options = options;
dialog.show();
}bright-gpu-74537
05/16/2022, 11:10 AMhaxe
typedef SelectFileDialogOptions = {
@:optional var readContents:Null<Bool>;
@:optional var readAsBinary:Null<Bool>;
@:optional var multiple:Null<Bool>;
}
typedef SelectedFileInfo = {
var name:String;
@:optional var fullPath:String;
@:optional var text:String;
@:optional var bytes:Bytes;
var isBinary:Bool;
}icy-zebra-52882
05/16/2022, 11:15 AMicy-zebra-52882
05/16/2022, 11:16 AMhx
var fileDialog = new SelectFileDialog();
fileDialog.callback = function(btn:DialogButton, fileList:Array<haxe.ui.backend.SelectFileDialogBase.SelectedFileInfo>) {
if (btn != DialogButton.CANCEL) {
romPathField.text = fileList[0].fullPath;
}
};
fileDialog.show();icy-zebra-52882
05/16/2022, 11:16 AMicy-zebra-52882
05/16/2022, 11:16 AMicy-zebra-52882
05/16/2022, 11:16 AMbright-gpu-74537
05/16/2022, 11:23 AMselectFile call is doing, so no reason to change your way, it might look a little cleaner, but thats about it:
haxe
Dialogs.selectFile(function(btn, fileList) {
if (btn != DialogButton.CANCEL) {
romPathField.text = fileList[0].fullPath;
}
});best-agent-85158
05/16/2022, 1:09 PMbright-gpu-74537
05/16/2022, 1:22 PMicy-zebra-52882
05/16/2022, 1:26 PMbright-gpu-74537
05/16/2022, 1:26 PMicy-zebra-52882
05/16/2022, 1:26 PMbest-agent-85158
05/16/2022, 1:46 PMbest-agent-85158
05/16/2022, 1:46 PMbright-gpu-74537
05/16/2022, 1:49 PM