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

TKasparek

  • Senior Community Member
  • Posts: 212
  • Hero Points: 25
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

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2789
  • Hero Points: 422
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;