Languages

Menu
Sites
Language
Pointer to Form

I have observed one interesting fact:

I have typical App with Frame and Form on it ( MyFrame Class inherited from Frame, MyForm Class inherited from Form)

Inside MyFrame Class I am able to get pointer to MyForm this way:
pForm1 =static_cast<Form*>(GetControl(L"IDF_FORM"));
but inside MyForm class I am unable to do this (returned adress is 0)

Could anybode explain me what the difference? Why it was allowed in one case but denied in another?

p.s. I have found how to get pointer to Form : just use 'this' enough, or
use ...GetAppFrame()->GetFrame()->GetCurrentForm();

Thank you in advance.
Alexey.

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

Responses

3 Replies
Nikhil M
Have you tried the following ? Form* pForm = static_cast< Form* >(GetParent());
wil smith
Containers maintain a list for child controls and GetControl() basically searches for the control in this list and returns the appropriate one. So inside form methods GetControl() won't be able to able to find the frame pointer as Frame is not child of Form.
Alex Dem
Ok. Thank you for explanation! p.s. static_cast< Form* >(GetParent()); returns pointer to Frame. Alexey.