TGUI Forum

General Category => General Discussion => Topic started by: 0x00 on 07 November 2016, 14:43:22

Title: Time for new bug.
Post by: 0x00 on 07 November 2016, 14:43:22
Hi again Texus :D
1. If MenuBar parented to Panel (or something else) we need to hold LMB to select something.

Code: [Select]
        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.

Code: [Select]

        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.
Title: Re: Time for new bug.
Post by: texus on 07 November 2016, 17:39:09
1) Try using the latest github version (https://github.com/texus/TGUI). 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.
Title: Re: Time for new bug.
Post by: 0x00 on 07 November 2016, 20:20:15
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() )
Title: Re: Time for new bug.
Post by: texus on 07 November 2016, 20:27:37
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.
Title: Re: Time for new bug.
Post by: 0x00 on 08 November 2016, 05:44:18
You are amazing thx for your work)
Title: Re: Time for new bug.
Post by: texus on 08 November 2016, 07:21:33
The issue with menu bar in a container is now fixed in 0.8-dev as well.