About Store Forum Documentation Contact



Post Reply 
Possible bug with hiding/showing
Author Message
fatcoder Offline
Member

Post: #1
Possible bug with hiding/showing
If you hide a GuiObj and then show it again within the same frame, it stops triggering its events. This problem is most noticeable with buttons.

You can reproduce the problem very easily using the Buttons tutorial in the Gui folder. Just add the following two lines of code to the end of the Update method (before the return true).

Code:
button_a.hide();
button_a.show();

Then run the tutorial and click on the first button. Notice the value at the top does not increment as the button's function event is no longer triggering.

On a side note, other than this bug (which can hopefully be fixed), is it ok to be calling hide and show on gui objects every frame performance wise? For example, I have some complex gui windows and I find it easier each frame to hide everything first, then only show what is needed based on the state of the gui window in that frame.
03-06-2012 04:21 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Possible bug with hiding/showing
@fatcoder: it is not a bug, when you hide button it loses focus and get's unpressed

Quote:is it ok to be calling hide and show on gui objects every frame performance wise?
hide works like that:
Code:
GuiObj& GuiObj::hide()
{
   if(visible())
   {
      ..
so yes it is fast

Quote:Isn't the gui rendering managed in a different thread than the rendering for world objects? I'm asking this thinking that more complex operations around gui does not impact game world performance. Do I have an accurate assumption?
gui updating/rendering is done on main thread
03-11-2012 05:48 PM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #3
RE: Possible bug with hiding/showing
(03-11-2012 05:48 PM)Esenthel Wrote:  @fatcoder: it is not a bug, when you hide button it loses focus and get's unpressed

OK, makes sense. Thanks for the reply.
03-11-2012 11:24 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Possible bug with hiding/showing
I recommend using button.visible(condition());
03-12-2012 02:51 PM
Find all posts by this user Quote this message in a reply
Post Reply