www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DlangUI FileDialog not working

reply stunaep <admin pea2nuts.com> writes:
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;
May 02 2016
parent Vadim Lopatin <coolreader.org gmail.com> writes:
On Tuesday, 3 May 2016 at 06:14:25 UTC, stunaep wrote:
 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.
Try fetch recent dlangui version (dub upgrade --force-remove). I fixed this issue last week. (There was a problem with sharing of OpenGL context between windows). Difference in dmledit is probably due to different dlangui configuration selected - it uses `minimal` configuration - w/o OpenGL acceleration.
May 03 2016