Why I cannot pass the folder name to a textbox?

textbox Box1(fm, nana::rectangle(110, 25, 735, 24));
....
....

Box1.caption(p); does not work with the folderbox example below:

#include <nana/gui/filebox.hpp>
#include <iostream>

int main()
{
    nana::folderbox picker;
    auto paths = picker.show();
    if(paths.empty())
    {
        std::cout<<"Cancelled"<<std::endl;
    }
    else
    {
        for(auto & p : paths)
            std::cout << "Selected folder:" << p << std::endl;            
        Box1.caption(p);
    }

}
Why I cannot pass the folder name to a textbox? textbox Box1(fm, nana::rectangle(110, 25, 735, 24)); .... .... Box1.caption(p); does not work with the folderbox example below: #include <nana/gui/filebox.hpp> #include <iostream> int main() { nana::folderbox picker; auto paths = picker.show(); if(paths.empty()) { std::cout<<"Cancelled"<<std::endl; } else { for(auto & p : paths) std::cout << "Selected folder:" << p << std::endl; Box1.caption(p); } }
edited Sep 25 at 8:05 pm

This is not your real code. p is not defined when you put it in Box1.caption(p); p is defined only inside the for.
But p is a filesystem::path. It may be not posible to convert to string.
You could use Box1.caption(p.string());

This is not your real code. p is not defined when you put it in Box1.caption(p); p is defined only inside the for. But p is a filesystem::path. It may be not posible to convert to string. You could use Box1.caption(p.string());
edited Sep 25 at 9:38 pm
12
110
views
21
replies
5
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