Jump to content

[SOLVED] calling class instance function from UI


photo

Recommended Posts

Posted

I have this situation

class X

{

  void foo()

 {

 ...

 }

}

 

 

 

X xinst=new X();

 

and ui file with

<callback type="clicked">xinst.foo</callback>

 

 

But, i get the can't find callback function error. Any help? Thanks.

Posted

Not sure, but you cannot call class instance functions directly, only static functions. Have a look into UNIGINE editor script code in <sdk-root>/data/core/editor, there should be plenty of examples for your use case.

Posted

David,

 

Please check sample/widgets/ui_00 to see how to call class method and pass an instance.

Posted

Thank you. Solved. It's not pretty, but works fine.

×
×
  • Create New...