Weird Multi-Effect Error With GUI

Started by MoLAoS, 04 March 2017, 00:50:22

MoLAoS

I am having an issue where sometimes if a function returns too fast, I assume, I get multiple events from a single click. There is also the hold down popping multiple events as well. Essentially a large function is only triggered once while relatively short functions go off several times. Is there a way to make sure a single click triggers only a single activation of a function connected to the GUI object?

texus

There shouldn't be any way for an event to trigger multiple times unless you called the connect function multiple times, so make sure you aren't doing that.
Having it depending on the duration of the function looks really weird. Are you certain gui.handleEvent is only called once for each sfml event?

MoLAoS

Nvm, found the problem sort of. Even with removeAllWidgets active someone my initial populatePanel function was somehow leaving widgets up or something? Problem seems to have been solved by, unlike with other such functions, preventing this particular panel from populating more than once.

texus

#3
Maybe you called removeAllWidgets on the wrong widget? I can't imagine any other case, the removeAllWidgets will definately get rid of all child widgets.

edit: or your kept a list of widgets in your own code which didn't get cleared and populatePanel inserted the widgets into that list as well

MoLAoS

#4
Okay, apparently during the many changes between versions as far as generating a picture pointer widget I changed many other widgets because of a misunderstanding where just setting a picture pointer equal to another one cause I was using the same image for many pictures caused them to move around funny. However for this particular panel I wasn't using the three images for anything. I store images in classes as picture pointers. By swapping to the copy function I was able to trigger the panel population function many times but not have the same issue since only the copies had functions attached or something. I assume.