LoadFromFile() & callbacks

Started by Heinrich, 31 August 2013, 15:43:46

Heinrich

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

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.

Heinrich

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

QuoteMaybe 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

Callbacks can now be loaded from widget files.

The widget files need to contain lines like these:
Callback = LeftMouseClicked
CallbackId = 1


You can pass multiple callbacks by placing a comma between them:
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.