Author Topic: Call class static function on window?  (Read 5509 times)

TKasparek

  • Senior Community Member
  • Posts: 246
  • Hero Points: 29
Call class static function on window?
« on: March 01, 2019, 08:33:31 PM »
How do I call a class static member on a window?

Code: [Select]
class MyClass {
   static void Foo(int bar) {
      return;
   }
};

void MyFunc() {
   // This doesn't seem to work...
   p_window_id.MyClass.Foo(1);
}

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: Call class static function on window?
« Reply #1 on: May 22, 2019, 04:08:01 PM »
Yes, that is a bit of an ambiguity with Slick-C.  It's a rare case.  The best workaround is to change the active window and then call the method.  "p_window_id" will persist as the active window in the class method.
Code: [Select]
    orig_wid := p_window_id;
    p_window_id = new_wid;
    MyClass.Foo(1);
    p_window_id = orig_wid;