Hi,
I want call loadWindowLayout(const String& filename, const String& name_prefix = "", const String& resourceGroup = "", PropertyCallback* callback = 0, void* userdata = 0) with set custom PropertyCallback method.
But I'm confused about function pointers etc...
Can somebody give me an example how can I set custom method?
Thanks
[Solved] How set PropertyCallback?
Moderators: CEGUI MVP, CEGUI Team
[Solved] How set PropertyCallback?
Last edited by djphilipe on Fri Apr 08, 2011 07:15, edited 1 time in total.
Re: How set PropertyCallback?
This is a small example of how to make it work:
If you need to translate values if the property name is text you do:
To make it tidier, put the PropertyCallback function into a class and make it static.
PS: I have not tried compiling this code, it's off the top of my head. HTH!
Code: Select all
bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata)
{
// some value transformation
propValue = propValue + "_something";
return true; // we want the property to be set in the end
}
void main()
{
WindowManager::getSingleton().loadWindowLayout("File.layout", "", "", &PropertyCallback);
}
If you need to translate values if the property name is text you do:
Code: Select all
bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata)
{
if (propName == "Text")
{
propValue = translateToSK(propValue);
}
return true;
}
void main()
{
WindowManager::getSingleton().loadWindowLayout("File.layout", "", "", &PropertyCallback);
}
To make it tidier, put the PropertyCallback function into a class and make it static.
PS: I have not tried compiling this code, it's off the top of my head. HTH!
Re: How set PropertyCallback?
I had tried this way even before you wrote me this answer. But I had method PropertyCallback in class (GUIMgr) and it wasn't static method and a compiler fell. I have added keyword "static" before this method and now it's work
Thanks for help
PS: I'm looking forward to World Hockey Championship 2011 - Final = Slovakia - Czech republic
Thanks for help
PS: I'm looking forward to World Hockey Championship 2011 - Final = Slovakia - Czech republic
Who is online
Users browsing this forum: No registered users and 7 guests