gtkmm 和 FileChooserButton 无法获取文件名
gtkmm and FileChooserButton can't get file name
这是我的代码,我尝试得到file_name后选择文件与小部件FileChooserButton
Gtk::FileChooserButton *chooserButton = nullptr;
std::string idChooserButton = commonArray[b]["id"];
builder->get_widget(idChooserButton, chooserButton);
Php::call("var_dump",chooserButton);
if (strcmp(commonArray[b]["action"], "click") == 0) {
Php::Value callback = commonArray[b]["callback"];
chooserButton->signal_selection_changed().connect(
sigc::bind<Php::Value,Php::Value>(
sigc::mem_fun(*this, &ParserGtk::callbacks),
callback,
chooserButton->get_filename()
)
);
}
我调用函数get_filename
,但get_filename
返回空字符串";
信号和sigc::bind
传递连接时计算的值。所以当你输入
chooserButton->get_filename()
这将返回一个空字符串,此时Gtk::FileChooserButton
还没有被显示或使用。
您需要在回调函数中调用chooserButton->get_filename()
来获取当前值
相关文章:
- 从 Makefile 中的 $@ 获取文件名
- 有没有一种简单的方法可以从 c++ 中的路径获取文件名?
- 从 SetClipboardData 挂钩获取文件名
- 是否有一种便携式/标准的方法可以在堆栈跟踪中获取文件名和亚麻布
- 如何从文件夹中获取文件名,并将它们添加到QT中的孩子中
- 从 Windows 上的 tmpfile() 获取文件名
- 是否可以从FSEvent id获取文件名
- 如何在单击mfc代码中的关系文件时获取文件名
- 如何在Qt中获取文件名
- 是否有一个WinAPI可以从带有可选空格和其他参数的命令行获取文件名
- 从控制台应用中的命令行参数获取文件名C++
- 从流中获取文件名(或路径)
- 如何在下载文件之前获取文件名
- 在调用函数的任何位置获取文件名和函数名
- 在c++ boost库中使用directory_iterator列出和获取文件名的问题
- 从路径中获取文件名
- gtkmm 和 FileChooserButton 无法获取文件名
- 如何从http请求体字符串获取文件名
- 如何在GNU Makefile中只获取文件名而不扩展名
- 如何从argv中获取文件名并将其与ifstream一起使用/将其更改为ofstream的txt