What conditions must satisfy a widget to receive the event

May 19, 2013 at 11:45 AM
Hi Jinhao!

Could you tell me what this code should do? :
int main()
    nana::gui::form f;
    auto p = std::unique_ptr<nana::gui::picture>(new nana::gui::picture(f,nana::size(100,100)));
        p = nullptr;
        auto q = std::shared_ptr<nana::gui::picture>(new nana::gui::picture(f,nana::size(100,100)));
        q->make_event<nana::gui::events::mouse_up>([q]() mutable
            q = nullptr;
When I press on the mouse button picture will become green,but
when I release mouse button,picture will not be destroyed.
To destroy it I should click on it one more time.
So is there any way to make so that picture receives mouse_up event immediatly?
May 19, 2013 at 5:45 PM
This behavior is defined by the library, this may be incorrect. I will check it.

When you press the RED picture, it will be destroyed due to "p = nullptr", and then the GREEN picture will be created. Next you release the button, the library will not call the handler of GREEN's mouse_up, because it is defined that the mouse_up should be answered when it is a window that is pressed.

Thanks for reporting this strange behavior in application environment.
May 19, 2013 at 6:09 PM
It would not be so important for me if there was a possibility to change widget's parent.
BTW,it would be nice,if you posted some roadmap for one or more future releases.
What do you think about it?
May 20, 2013 at 5:49 PM
Hi, Zchapovsky.
The mouse_up issue is fixed, please try the latest commit from "source code".
Thank you
May 20, 2013 at 6:20 PM
Yes,now it seems to be ok.
Thanks for quick fix:)