Time for new bug.

Started by 0x00, 07 November 2016, 14:43:22

0x00

Hi again Texus :D
1. If MenuBar parented to Panel (or something else) we need to hold LMB to select something.


        tg::Gui gui(window);
        tg::Theme theme("Black.txt");

auto panel = tg::Panel::create();
panel->setRenderer(theme.getRenderer("Panel"));
panel->setSize(tg::bindSize(gui));
gui.add(panel);

auto menu = tg::MenuBar::create();
menu->setRenderer(theme.getRenderer("MenuBar"));
menu->addMenu("Menu");
menu->addMenuItem("Item One");
menu->addMenuItem("Item Two");
panel->add(menu); //gui.add(menu) for correct selection


2. RadioButton - can't unckeck after checking.


        auto radio = tg::RadioButton::create();
radio->setRenderer(theme.getRenderer("RadioButton"));
radio->connect("Checked", []() {printf("RadioButton Checked!\n"); });
radio->connect("Unchecked", []() {printf("RadioButton Unchecked!\n"); }); //Wrong! can't handle uncheck event (?)
radio->connect("Clicked", []() {printf("RadioButton Clicked!\n"); }); //Triggered every click. (its fine)
panel->add(radio);


P.S. I'm still programming and if I'll get any other bugs with other elements I'll update that post.

texus

1) Try using the latest github version. What you are describing was the cause of the issue that you had with menu bar in vertical layout. I said back then that I had fixed it but I found out later that I made another mistake, so the real fix was made less than 2 weeks ago.

2) Radio buttons aren't supposed to be unchecked, they are for selecting one option out of several radio buttons. You need the CheckBox class for boxes that you can freely check and uncheck.

0x00

1) I'm using 0.8 version and bug still be.
2) My mistake need more coffe and I think wee need something like RadioButtonGroup when we have 5 RadioButtons and check one of them then other are unchecks automaticaly.
P.s. thx for GetCaretPos() )

texus

1) I only fixed it on 0.7, I'll apply the fix to 0.8 tomorrow
2) Panels have to be used as radio button group (when one radio button is checked then all other radio buttons with the same parent are unchecked). Adding a RadioButtonGroup class to make it easier is already on the todo list for 0.8 though.

0x00

You are amazing thx for your work)

texus

The issue with menu bar in a container is now fixed in 0.8-dev as well.