diff -r aecbbf00d063 -r d48ab3b357f1 uifw/AvKon/src/AknPopupField.cpp --- a/uifw/AvKon/src/AknPopupField.cpp Tue Aug 31 15:28:30 2010 +0300 +++ b/uifw/AvKon/src/AknPopupField.cpp Wed Sep 01 12:16:19 2010 +0100 @@ -208,10 +208,7 @@ void CAknPopupField::SetUpScrollBarL() { - if ( !iExtension || !iExtension->iSingleClickEnabled ) - { - __ASSERT_DEBUG( iCba, Panic( EAknPanicPopupFieldCBADoesntExist ) ); - } + __ASSERT_DEBUG( iCba, Panic( EAknPanicPopupFieldCBADoesntExist ) ); __ASSERT_DEBUG(iSelectionList != NULL, Panic(EAknPanicPopupFieldSelectionListDoesntExist)); iSelectionList->SetMopParent(this); // to get remote scb iSelectionList->CreateScrollBarFrameL(ETrue, ETrue); @@ -222,15 +219,15 @@ void CAknPopupField::SetScrollBarSelectionL() { TInt selection = iValue->CurrentValueIndex(); + //iOldItemIndex should be saved as original value. + if ( iExtension ) + { + iExtension->iOldItemIndex = selection; + } if (IsInvalid()) selection = 0; __ASSERT_DEBUG(iSelectionList != NULL, Panic(EAknPanicPopupFieldSelectionListDoesntExist)); iSelectionList->SetCurrentItemIndex(selection); iSelectionList->View()->SelectItemL(selection); - - if ( iExtension ) - { - iExtension->iOldItemIndex = iSelectionList->CurrentItemIndex(); - } } @@ -443,7 +440,13 @@ case EAknPopupFieldSelectionListMode: { __ASSERT_DEBUG(iSelectionList != NULL, Panic(EAknPanicPopupFieldSelectionListDoesntExist)); - iSelectionList->SetRect(rect); + // When Form loses focus, If its child control listbox's size or position is not changed, + // do not invoke "iSelectionList->SetRect(rect);". + if ((iSelectionList->Position() != rect.iTl) || (iSelectionList->Size() != rect.Size())) + { + iSelectionList->SetRect(rect); + SetScrollBarSelectionL(); + } AknsUtils::RegisterControlPosition(this); AknsUtils::RegisterControlPosition(iSelectionList); TRect listBoxRect = iExtension->iFormFieldRect; //iSelectionList->Rect(); @@ -653,15 +656,30 @@ case MEikListBoxObserver::EEventItemSingleClicked: { CListBoxView* view = iSelectionList->View(); - - if ( view->CurrentItemIndex() != iExtension->iOldItemIndex ) + TInt selection = view->CurrentItemIndex(); + if ( selection != iExtension->iOldItemIndex ) { view->DeselectItem( iExtension->iOldItemIndex ); - iExtension->iOldItemIndex = view->CurrentItemIndex(); - view->SelectItemL( iExtension->iOldItemIndex ); + iExtension->iOldItemIndex = selection; + view->SelectItemL( selection ); + + TInt decoratedIndex; + TBool decorated = iDecorator.DecoratedIndex( decoratedIndex ); + if ( decorated && ( selection == decoratedIndex ) ) + { + TBool accepted = iValue->CreateEditorL(); + if ( !accepted ) + { + break; + } + } + else + { + iValue->SetCurrentValueIndex( selection ); + } } } - + // fall through case MEikListBoxObserver::EEventItemDoubleClicked: case MEikListBoxObserver::EEventEnterKeyPressed: { @@ -827,10 +845,7 @@ void CAknPopupField::CreatePopoutL() { - if ( !iExtension || !iExtension->iSingleClickEnabled ) - { - CreateCbaL(); - } + CreateCbaL(); ConstructSelectionListL(); ChangeMode(EAknPopupFieldSelectionListMode); SetUpScrollBarL(); @@ -917,7 +932,7 @@ && iExtension && iExtension->iSingleClickEnabled ) { // Edit mode to view while popup is open -> first cancel popup - AttemptExitL( EFalse ); + TRAP_IGNORE(AttemptExitL( EFalse )); } else { @@ -1160,6 +1175,14 @@ } } +EXPORT_C void CAknPopupField::CloseSelectionListL() + { + if ( iSelectionMode == EAknPopupFieldSelectionListMode + && iSelectionList ) + { + AttemptExitL( EFalse ); + } + } void CAknPopupField::ConfigureDecorator() { @@ -1198,23 +1221,27 @@ if (aAccept) { - // get current selection - const TInt selection=iSelectionList->CurrentItemIndex(); - TInt decoratedIndex; - TBool decorated = iDecorator.DecoratedIndex(decoratedIndex); - if (decorated && (selection == decoratedIndex)) + if ( iSelectionList->IsHighlightEnabled() ) { - TBool accepted = iValue->CreateEditorL(); - if (!accepted) + // get current selection + const TInt selection=iSelectionList->CurrentItemIndex(); + TInt decoratedIndex; + TBool decorated = iDecorator.DecoratedIndex(decoratedIndex); + if (decorated && (selection == decoratedIndex)) { - // dialog was cancelled, so popup list must remain - finished = EFalse; + TBool accepted = iValue->CreateEditorL(); + if (!accepted) + { + // dialog was cancelled, so popup list must remain + finished = EFalse; + } + } + else + { + iValue->SetCurrentValueIndex(selection); } } - else - iValue->SetCurrentValueIndex(selection); } - if (finished) { delete iCba;