OnPackageWillBeLoaded overwritting not calling?
#1
Apost 
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.
✠ nnDnn ✠ The peace of Christ! ✠ nnDnn ✠
Reply
#2
Apost 
(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:

  1. First the debug package is loaded.
  2. Then the startup package is loaded and executed.
  3. In the background the main package is loaded.
  4. 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.
Reply
#3
Apost 
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:

  1. First the debug package is loaded.
  2. Then the startup package is loaded and executed.
  3. In the background the main package is loaded.
  4. 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.
✠ nnDnn ✠ The peace of Christ! ✠ nnDnn ✠
Reply


Forum Jump:


Copyright © 2011-2017 Spraylight GmbH.