LoadFromFile() & callbacks
« on: 31 August 2013, 15:43:46 »
I couldn't find out how to specify callbacks when loading from a file. Or how to otherwise get informed of events. Please assist.

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: LoadFromFile() & callbacks
« Reply #1 on: 31 August 2013, 15:55:12 »
It can't be done. It is a functionality that disappeared when writing the callback system of tgui v0.6.
I am planning to allow it again, but this will require me to manually check every widget agains every different kind of callback that it has, so its a pretty big change (lot of copy pasting though).

I am actually waiting until the new form builder is ready. It will allow me to make a few more simplifications to the loading from file, giving me slightly less work with implementing this. The only problem is that this can still take some time. I really hope to get it finished before september 20th though, afterwards I won't have so much spare time anymore.

Re: LoadFromFile() & callbacks
« Reply #2 on: 31 August 2013, 17:21:42 »
Awesome. I forgot there was a form builder. Can't wait to check that out when you release it.
Maybe you should remove LoadFromFile() from 0.6  code examples meanwhile.
Also thank you for your swift replies.

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: LoadFromFile() & callbacks
« Reply #3 on: 31 August 2013, 17:26:10 »
Quote
Maybe you should remove LoadFromFile() from 0.6  code examples meanwhile.
I could do that, but I'm just going to keep it for now. In the end, everything still works except passing callbacks.

The widgets can be given a name so that you can get a pointer to it in the c++ code and add a callback there.
Of course it would be easier if it would be integrated in the widget files, but it isn't completely useless in its current state.

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: LoadFromFile() & callbacks
« Reply #4 on: 15 September 2013, 16:52:08 »
Callbacks can now be loaded from widget files.

The widget files need to contain lines like these:
Code: [Select]
Callback = LeftMouseClicked
CallbackId = 1

You can pass multiple callbacks by placing a comma between them:
Code: [Select]
Callback = Focused, Unfocused
Also because of how the new form builder is written, you will also be able to change the callbacks from within the form builder.