Hi @ all,
I have developed a small application, with some labels, which are drawn to the view. My problem is now, that if I change the view to Landscape, my lowermost label, is not anymore on the screen, because I have hardcoded the positions in pixel. I tried to figure out now, what view is activated and depending on it, draw the labels higher/more to the left, because now I have more room to fit 2 labels in one row, and wouldn't need to many rows, so everything fits on the screen again.
I have read some wiki pages about it, and searched in the forum and knowlege base, but I didn't find a solution to my prob.
I tried last the version with CCoeEnv, but this always returns me EAppUiOrientationUnspecified! :(
Here is my code, I'll try to handle it in the SizeChanged() funktion (maybe it's the wrong place to do this?):
What am I doing wrong? Thanks a lot in advance for your help!Code:void CTestProgramAppView::SizeChanged() { TInt yOffset = 0; CCoeEnv* env = CCoeEnv::Static(); if( env ) { CAknAppUiBase* appUiBase = REINTERPRET_CAST( CAknAppUiBase*, env->AppUi() ); if( appUiBase ) { /* * Possible values for TAppUiOrientation are : * EAppUiOrientationUnspecified, * EAppUiOrientationPortrait, * EAppUiOrientationLandscape, * EAppUiOrientationAutomatic **/ CAknAppUiBase::TAppUiOrientation orientation = appUiBase->Orientation(); if (orientation == CAknAppUiBase::EAppUiOrientationLandscape) { yOffset = 20; } } } iLabelHeading->SetExtent( TPoint(10,10), iLabelHeading->MinimumSize()); iLabelHeadingText->SetExtent( TPoint(10 + 4* yOffset ,30 -yOffset), iLabelHeadingText->MinimumSize()); // ... more labels follow iLabelAdditionalInformationText->SetExtent( TPoint(10,200 -yOffset), TSize(250,70)); DrawNow(); }
Cheers,
Matt
p.s. I also tried it with:
but here I just know, a view switch happened, and I still don't know if its portait or landscape...?!Code:void CScalableScreenDrawingControl::HandleResourceChange(TInt aType) { CCoeControl::HandleResourceChange(aType); if(aType == KEikDynamicLayoutVariantSwitch) { // ... } }



