Nana C++ Library 1.6.0 Available Now

Nana 1.6 brings several updates – including enhanced stability, usability and numerous other bug fixes and improvements. Now, nana can works on FreeBSD. Many features and bug fixes are requested by users, many thanks to all the developers who interacted with us on Github and forum lately.

You can find a release note using this link.

Please visit homepage to see who’ve contributed to this release.

New Features in Nana 1.6

Nana 1.6 has a variety of new features for extending the existing components. Let’s have a look at these new features.

Keyboard Accelerator

A new method called keyboard_accelerator has been added to the class form. It is used for registerring a key and a callback object. When the key is pressed, the corresponding callback object get called. It’s unlike the event key_press, the keyboard accelerated callback object is always called if the focus is on the form or other child widget which is belong to the form.

Changable Listbox Header Font

Now, the font of listbox header is changable.

New Class scroll_operation_interface

The scroll_operation_interface defines a function to operate the scrollbars which are contained by a widget, such as textbox, treebox and listbox. Now it only provide a visible() method to determine the visibility of the scrollbar, it will be extended in future.

Switchable Field

Sometimes, we need to create panels like what tab does. With switchable field, we can easy to make it.

int main()
{
    using namespace nana;

    form fm;

    button switch_btn{ fm };

    listbox list{ fm };
    textbox text{ fm };
    label labl{ fm };
    labl.caption("label");
    fm.div("<btn><switchable <list><text><label>>");
    fm["btn"] << switch_btn;
    fm["list"] << list;
    fm["text"] << text;
    fm["label"] << labl;
    fm.collocate();


    //one of the panel list, text and label is shown when every time the switch_btn get clicked.
    switch_btn.events().click([&] {
        static std::vector<std::string> panels{"list", "text", "label"};
        static int i = 0;
        ++i;
        if (i >= panels.size())
            i = 0;

        //Displays one of the field, other 2 fields will be hidden automatically.
        fm.get_place().field_display(panels[i].c_str(), true);
        fm.collocate();
    });

    fm.show();
    exec();
}

At last, please give me a chance to explain why the release 1.6 is different from mentioned in post Roadmap for 1.6. The cross-platform High-DPI support is still under development, according to my design of the feature, there are some advanced features need to be solved, it’s a challenge about time and intelligence. Another feature listbox virtual model is also delayed.

One Comment

  1. Pingback: Valuable News – 2018/05/25 | vermaden

Leave a Reply