DlangUI FileDialog not working

stunaep via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 2 23:14:25 PDT 2016


FileDialog is showing a blank white window for me. Only tested on 
windows 7 so far, but if I run dmledit, the filedialog on there 
works fine. It's weird because I am using almost exactly the same 
code.

Here is what it looks like
http://i.imgur.com/qslu7tJ.png

handleAction code:

>                case ProgramActions.FolderOpen:
>                	UIString caption;
>                    caption = "OPEN_DIR"c;
>                    FileDialog dlg = createFileDialog(caption, 
> true);
>                    dlg.dialogResult = delegate(Dialog dlg, 
> const Action result) {
>                        if (result.id == ACTION_OPEN.id) {
>                            string filename = result.stringParam;
>                            //TODO
>                        }
>                    };
>                    dlg.show();
>                return true;
> 
>                case ProgramActions.FileOpen:
>                	UIString caption;
>                    caption = "FILE_OPEN"c;
>                    FileDialog dlg = createFileDialog(caption, 
> false);
>                    
> dlg.addFilter(FileFilterEntry(UIString("D_FILES"c), "*.d"));
>                    
> dlg.addFilter(FileFilterEntry(UIString("ALL_FILES"c), "*.*"));
>                    dlg.dialogResult = delegate(Dialog dlg, 
> const Action result) {
>                        if (result.id == ACTION_OPEN.id) {
>                            string filename = result.stringParam;
>                            //TODO
>                        }
>                    };
>                    dlg.show();
>                return true;

Here is my createFileDialog

>    FileDialog createFileDialog(UIString caption, bool folder, 
> bool fileMustExist = true) {
>        uint flags = DialogFlag.Modal | DialogFlag.Resizable;
>        if (fileMustExist)
>            flags |= FileDialogFlag.FileMustExist;
>        if (folder)
>            flags |= FileDialogFlag.SelectDirectory;
>        FileDialog dlg = new FileDialog(caption, window, null, 
> flags);
>        //dlg.filetypeIcons[""] = "";
>        return dlg;
>    }

also have this in handleActionStateRequest:

>                if (!_currentBackgroundOperation)
>                    a.state = ACTION_STATE_ENABLED;
>                else
>                    a.state = ACTION_STATE_DISABLE;


More information about the Digitalmars-d-learn mailing list