get access to AppUI members
| Sat, 2006-02-25 13:44 | |
|
Hi! How can I get access to AppUi member functions and variables from things like containers which are contained within views which are in turn contained in the AppUi? Do I need to pass a reference to the AppUi to the container or is there a better way? I have seen iEikonEnv being used as follows:
Code: STATIC_CAST(CdiscoveryAppUi*, iEikonEnv->EikAppUi())->iBTManager->StartDeviceInquiryL( iDevices, this ); where CdiscoveryAppUi is my AppUi class. But the above code gives me an error : 'static_cast' : cannot convert from 'CEikAppUi *' to 'CdiscoveryAppUi *' |
|






Forum posts: 732
But the above code gives me an error : 'static_cast' : cannot convert from 'CEikAppUi *' to 'CdiscoveryAppUi *'
From which class did you derive the class CdiscoveryAppUi?
Please make sure that you have derived CdiscoveryAppUi from correct base class. From your post it's clear that you are using views and containers. So your CdiscoveryAppUi class might be derived from CAknViewAppUi.
Forum posts: 13
Which is a better approach, static casting or passing in a reference, or does it make any difference at all?
Forum posts: 239
You can try like this
CMyAppUi* myAppUi= (CMyAppUi *)iCoeEnv->AppUi();
BR
---------------
Bhatt Kavita
Forum posts: 8
CMyAppUi* myAppUi= dynamic_cast<CMyAppUi *>(iCoeEnv->AppUi());
if(myAppUi == NULL)
  ;// i missed my-App UI
else
  ;// I got my-App UI
Experience is a good teacher..
Are you a good student ?
Forum posts: 239
//
CMyAppUi* myAppUi= dynamic_cast<CMyAppUi *>(iCoeEnv->AppUi());
//
---------------
Bhatt Kavita
Forum posts: 8
reinterpret_cast should be fine..
Experience is a good teacher..
Are you a good student ?
Forum posts: 239
you r right..
It may be used like this
#define APPUI STATIC_CAST(CMyAppUi*, iCoeEnv->AppUi())
Thanks for correcting me
---------------
Bhatt Kavita
Forum posts: 239
I also gone through docs...but why symbian doesn't support dynamic_cast.
BR
---------------
Bhatt Kavita