The code below does not let me select multiple folders. I tried Shift+mouse, Ctrl+mouse, Alt+mouse and non of them worked! What am I doing wrong?

int main()
{
    nana::folderbox picker;

    picker.allow_multi_select(true);
    auto paths = picker.show();
    if(paths.empty())
    {
        std::cout<<"Cancelled"<<std::endl;
    }
    else
    {
        for(auto & p : paths)
            std::cout << "Selected folder:" << p << std::endl;
    }
}
The code below does not let me select multiple folders. I tried Shift+mouse, Ctrl+mouse, Alt+mouse and non of them worked! What am I doing wrong? ```` int main() { nana::folderbox picker; picker.allow_multi_select(true); auto paths = picker.show(); if(paths.empty()) { std::cout<<"Cancelled"<<std::endl; } else { for(auto & p : paths) std::cout << "Selected folder:" << p << std::endl; } } ````
edited May 18 at 7:04 pm

There are different ways to implement the folderbox between VC and MinGW. Generally, the implementation using MinGW doesn't support the multiple selection. However, you can try to enable the VC implementation by modifying the filebox.cpp. I am not sure whether the MinGW distro that you are using supports the implementation.

Open nana\source\gui\filebox.cpp. Find the definition of folderbox::show().

    std::vector<folderbox::path_type> folderbox::show() const
    {
        std::vector<path_type> targets;
#ifdef NANA_WINDOWS

        nana::detail::platform_spec::co_initializer co_init;
#ifndef NANA_MINGW
        IFileOpenDialog *fd(nullptr);

Then, change #ifndef NANA_MINGW to #ifdef NANA_MINGW.

Save the modification and rebuild nana.

There are different ways to implement the folderbox between VC and MinGW. Generally, the implementation using MinGW doesn't support the multiple selection. However, you can try to enable the VC implementation by modifying the `filebox.cpp`. I am not sure whether the MinGW distro that you are using supports the implementation. Open `nana\source\gui\filebox.cpp`. Find the definition of `folderbox::show()`. ```c++ std::vector<folderbox::path_type> folderbox::show() const { std::vector<path_type> targets; #ifdef NANA_WINDOWS nana::detail::platform_spec::co_initializer co_init; #ifndef NANA_MINGW IFileOpenDialog *fd(nullptr); ``` Then, change `#ifndef NANA_MINGW` to `#ifdef NANA_MINGW`. Save the modification and rebuild nana.

Hi Jinhao,

If NANA is built based on ISO C++ , then why using different ISO C++ compiler should affect its behavior?

Can you update nana::filebox implementation so that it works with any ISO C++ compiler?

Hi Jinhao, If NANA is built based on ISO C++ , then why using different ISO C++ compiler should affect its behavior? Can you update nana::filebox implementation so that it works with any ISO C++ compiler?
edited May 19 at 3:32 am

Because some MinGW distros don't support COM headers completely, so it's nothing about ISO C++.

Because some MinGW distros don't support COM headers completely, so it's nothing about ISO C++.

I am using Code::Blocks 17.12 with MSYS2 MinGW 8.3 compiler and I thought this a recommnded compiler for NANA.

Do you know any other C++ compiler that has the complete implementation of COM headers?

I am using Code::Blocks 17.12 with **MSYS2 MinGW 8.3** compiler and I thought this a recommnded compiler for NANA. Do you know any other C++ compiler that has the complete implementation of COM headers?
45
views
4
replies
2
followers
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft