gammasoft71 / xtd

Free open-source modern C++17 / C++20 framework to create console, GUI (forms like WinForms) and unit test applications and libraries on Microsoft Windows, Apple macOS and Linux.
https://gammasoft71.github.io/xtd
MIT License
737 stars 58 forks source link

[BUG] xtd.forms - Regression: combo_box drop_down and drop_down_closed events not firing #191

Closed jimorc closed 1 year ago

jimorc commented 1 year ago

Describe the bug

A change made to master in the last few days has caused the combo_box drop_down and drop_down_closed events to stop firing. See the program listing:

#include <xtd/xtd>
#include <iostream>

using namespace xtd;
using namespace xtd::forms;

class dialog : public form
{
    public:
        dialog()
        {
            box.drop_down_style(combo_box_style::drop_down_list);
            box.items().push_back_range({"Item 1", "Item 2"});
            box.drop_down += xtd::event_handler(
            *this, &dialog::on_device_combo_box_drop_down);
            box.drop_down_closed += xtd::event_handler(
            *this, &dialog::on_device_combo_box_drop_down_closed);

            vlp << box;
            vlp.anchor(anchor_styles::all);
            vlp.control_layout_style(box, {size_type::auto_size, true});

            *this << vlp;
        }
        void on_device_combo_box_drop_down(object& sender, const xtd::event_args& e)
        {
            std::cout << "In drop_down\n";
        }

        void on_device_combo_box_drop_down_closed(object& sender,
            const xtd::event_args& e)
        {
            std::cout << "In drop_down_closed\n";
        }
    private:
        vertical_layout_panel vlp;
        combo_box box;
};

class form1 : public form
{
    public:
        form1()
        {
            dbutton.text("Show Dialog");
            dbutton.click += [&] {
                show_dialog_box(); 
            };

            *this << dbutton;
        }
        void show_dialog_box()
        {
            dialog d;
            d.show_dialog(*this);
        }

    private:
        button dbutton;
};
int main()
{
    form1 f;
    application::run(f);
    return EXIT_SUCCESS;
}

To Reproduce

  1. Build the program above and execute it.
  2. Click on 'Show Dialog' button.
  3. In the dialog that opens, open the drop_down_list combo_box.
  4. Close the drop_down_list. 5.See the output: No output from the drop_down and drop_down_closed event handlers. There was output printed using master from several days ago.

Expected behaviour

The following lines should have been printed:

In drop_down
In drop_down_closed

Screenshots

N/A

Desktop (please complete the following information)

Additional context

N/A

Workaround

None

gammasoft71 commented 1 year ago

Yes there is a mistake with the reflection of messages. I will see to fix it asap.