Languages

Menu
Sites
Language
How to access Form from Panel?;

Hello!

I have defined a function in my main form and I would like to access it in the code of the panels, but to do that I need to access the Form object.

I've tried something like

 

MainForm* form = static_cast <MainForm*>  (GetControl(L"IDC_FORM"));

and also 

 

SceneManager* pSceneManager = SceneManager::GetInstance();
Scene* scene = pSceneManager->GetCurrentScene();
Form* form = scene->GetForm();
MainForm* form = static_cast <MainForm*>  (form);
 
both these compile, and both crash without an error message when I try to do
 
form->functionIWantToCall();

Any idea how I'm supposed to do this?

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

1 Replies
dhirku
Nothing looks wrong with the Scene manager approach. May be the scene is unregistered / removed from scene manager history ..... or it wasn't added to the scenemanager Also always .. always do a null check on the return value ..... probably one of the returned values are null due to some pr the other reason Check if the scene is alive , using IsSceneAlive() method