[RESOLVED] static functions and statusbars
I have no choice but to use a static member function for a particular peice of code. But it requires being able to set the text of a pane in my statusbar control and ofcourse, it doesn't work since the status bar is not static and I can't use "this".
In short then, how can I set the text via this static member function?
Re: static functions and statusbars
Hi...
You are right, you can't set a string while your status bar is not a window.
To avoid this problem, it is better to have a static char array, then use not static, something like SetString, function, when your status bar is created.
AAvetyan
Re: static functions and statusbars
Hi
I'm not too sure how to implement what you are saying. I've ended up making a global function which accesses a pointer to the dialog. This allows me access to the dialog status bar. A global function is also permissable as opposed to a static member function as a parameter passed to this other function which requires it. (make sense?!!!)
Re: static functions and statusbars
The alternative way for static member functions to access an instance of the class, is to pass an instance into them as an argument when they're called...
class Foo {
public:
static void staticMFunc(Foo& aFooInst) { aFooInst.otherFunc(); }
void otherFunc() {}
};
void Bar()
{
Foo aFoo;
Foo::staticMFunc(aFoo);
}
Dave