除了构造函数参数之外,我可以更改FL_Window的标题吗?

App*_*ker 1 c++ fltk

MainWindow::MainWindow(int w, int h, const string& c)
: Fl_Window(w, h, c.c_str()) // Don't call constructor over here
{
    script.load_file(WIN_CONFIG_SCRIPT);

    int width = script.get_global_int("width");
    int height = script.get_global_int("height");

    const char* caption = script.get_global_string("caption").c_str();

    /** CALL CONSTRUCTOR NOW **/

    //NOTE: I don't know a way to change an FLTK Fl_Window's Caption after 
    //initialising it.

    Toolbar* toolbar = new Toolbar(0, 0, this->w(),30);
    toolbar->add_button("Hello");
    toolbar->add_button("World!");

    end();
}
Run Code Online (Sandbox Code Playgroud)

如何初始化基类的构造?或者,如何初始化更改FLTK Fl_Window的标题?这个烂摊子还有其他方法吗?

Lig*_*ica 6

如何在构造函数中初始化基类?

你不可以.

必须在实例的派生部分或其任何成员之前初始化实例的基本部分.


初始化后如何更改FLTK Fl_Window的标题?

文档说你可以打电话:

label("my caption")
Run Code Online (Sandbox Code Playgroud)

这有什么问题?


出于这种混乱的任何其他方式?

没有.


此外,您应该升级到FLTK 2.