Weird Multi-Effect Error With GUI
« on: 04 March 2017, 00:50:22 »
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?
« Last Edit: 04 March 2017, 01:06:49 by texus »

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Weird Multi-Effect Error With GUI
« Reply #1 on: 04 March 2017, 00:54:50 »
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?

Re: Weird Multi-Effect Error With GUI
« Reply #2 on: 04 March 2017, 01:38:57 »
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

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Weird Multi-Effect Error With GUI
« Reply #3 on: 04 March 2017, 01:43:02 »
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
« Last Edit: 04 March 2017, 01:44:40 by texus »

Re: Weird Multi-Effect Error With GUI
« Reply #4 on: 04 March 2017, 02:08:02 »
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.
« Last Edit: 04 March 2017, 02:15:17 by MoLAoS »