0

this is my code, I try get file_name after choose file with widget 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() ) ); } 

I call functino get_filename but get_filename return empty string "";

1 Answer 1

1

Signals and sigc::bind pass values computed at connection time. So when you do

chooserButton->get_filename() 

This will return an empty string, the Gtk::FileChooserButton having not been displayed or used at that point.

You will need to call chooserButton->get_filename() in your call-back function to get the current value.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.