OnPackageWillBeLoaded overwritting not calling? - Flávio San - 21 Nov 2015
Hello!
In the Tutorial # 02: Color Cube
I'm trying to get a debug message when OnPackageWillBeLoaded for the main package.
I overwritten it with the signature: void Murl::App::ColorCubeLogic::OnPackageWillBeLoaded(const Logic::IState *state, IPackage *package)
With the body definition code: state->AddUserDebugMessage("ColorCubeLogic::OnPackageWillBeLoaded");
The problem is that there is no other Debug messages in the program and the message is never showed.
RE: OnPackageWillBeLoaded overwritting not calling? - Ketschak - 22 Nov 2015
(21 Nov 2015, 21:24)Flávio Rebouças Santos Wrote: Hello!
In the Tutorial # 02: Color Cube
I'm trying to get a debug message when OnPackageWillBeLoaded for the main package.
I overwritten it with the signature: void Murl::App::ColorCubeLogic::OnPackageWillBeLoaded(const Logic::IState *state, IPackage *package)
With the body definition code: state->AddUserDebugMessage("ColorCubeLogic::OnPackageWillBeLoaded");
The problem is that there is no other Debug messages in the program and the message is never showed.
Hi Flávio,
you don't get a message because no package is loaded during the time your logic class is active. Let me explain step by step what is going on:
- First the debug package is loaded.
- Then the startup package is loaded and executed.
- In the background the main package is loaded.
- After the the main package has finished loading the corresponding logic processor is added to the pool of logic processors and the Init method is executed. Now your logic class is active but all packages are already loaded.
If you overwrite the OnPackageWillBeUnloaded method you can see when the startup package is unloaded.
void Murl::App::ColorCubeLogic::OnPackageWillBeUnloaded(const Logic::IState *state, IPackage *package)
{
state->AddUserDebugMessage("ColorCubeLogic::OnPackageWillBeUnloaded");
Debug::Trace("ColorCubeLogic::OnPackageWillBeUnloaded %s", package->GetName().Begin());
}
If you load additional packages e.g. with your logic class you will also see OnPackageWillBeLoaded events.
Hope that helps.
RE: OnPackageWillBeLoaded overwritting not calling? - Flávio San - 22 Nov 2015
Hi Ketschak!
I had suspected it, but your clarification confirmed me.
Best Regards!
(22 Nov 2015, 19:40)Ketschak Wrote: (21 Nov 2015, 21:24)Flávio Rebouças Santos Wrote: Hello!
In the Tutorial # 02: Color Cube
I'm trying to get a debug message when OnPackageWillBeLoaded for the main package.
I overwritten it with the signature: void Murl::App::ColorCubeLogic::OnPackageWillBeLoaded(const Logic::IState *state, IPackage *package)
With the body definition code: state->AddUserDebugMessage("ColorCubeLogic::OnPackageWillBeLoaded");
The problem is that there is no other Debug messages in the program and the message is never showed.
Hi Flávio,
you don't get a message because no package is loaded during the time your logic class is active. Let me explain step by step what is going on:
- First the debug package is loaded.
- Then the startup package is loaded and executed.
- In the background the main package is loaded.
- After the the main package has finished loading the corresponding logic processor is added to the pool of logic processors and the Init method is executed. Now your logic class is active but all packages are already loaded.
If you overwrite the OnPackageWillBeUnloaded method you can see when the startup package is unloaded.
void Murl::App::ColorCubeLogic::OnPackageWillBeUnloaded(const Logic::IState *state, IPackage *package)
{
state->AddUserDebugMessage("ColorCubeLogic::OnPackageWillBeUnloaded");
Debug::Trace("ColorCubeLogic::OnPackageWillBeUnloaded %s", package->GetName().Begin());
}
If you load additional packages e.g. with your logic class you will also see OnPackageWillBeLoaded events.
Hope that helps.
|