443 // When Form loses focus, If its child control listbox's size or position is not changed, |
443 // When Form loses focus, If its child control listbox's size or position is not changed, |
444 // do not invoke "iSelectionList->SetRect(rect);". |
444 // do not invoke "iSelectionList->SetRect(rect);". |
445 if ((iSelectionList->Position() != rect.iTl) || (iSelectionList->Size() != rect.Size())) |
445 if ((iSelectionList->Position() != rect.iTl) || (iSelectionList->Size() != rect.Size())) |
446 { |
446 { |
447 iSelectionList->SetRect(rect); |
447 iSelectionList->SetRect(rect); |
|
448 SetScrollBarSelectionL(); |
448 } |
449 } |
449 AknsUtils::RegisterControlPosition(this); |
450 AknsUtils::RegisterControlPosition(this); |
450 AknsUtils::RegisterControlPosition(iSelectionList); |
451 AknsUtils::RegisterControlPosition(iSelectionList); |
451 TRect listBoxRect = iExtension->iFormFieldRect; //iSelectionList->Rect(); |
452 TRect listBoxRect = iExtension->iFormFieldRect; //iSelectionList->Rect(); |
452 listBoxRect.iTl = TPoint(0,0); |
453 listBoxRect.iTl = TPoint(0,0); |
653 switch ( aEventType ) |
654 switch ( aEventType ) |
654 { |
655 { |
655 case MEikListBoxObserver::EEventItemSingleClicked: |
656 case MEikListBoxObserver::EEventItemSingleClicked: |
656 { |
657 { |
657 CListBoxView* view = iSelectionList->View(); |
658 CListBoxView* view = iSelectionList->View(); |
658 |
659 TInt selection = view->CurrentItemIndex(); |
659 if ( view->CurrentItemIndex() != iExtension->iOldItemIndex ) |
660 if ( selection != iExtension->iOldItemIndex ) |
660 { |
661 { |
661 view->DeselectItem( iExtension->iOldItemIndex ); |
662 view->DeselectItem( iExtension->iOldItemIndex ); |
662 iExtension->iOldItemIndex = view->CurrentItemIndex(); |
663 iExtension->iOldItemIndex = selection; |
663 view->SelectItemL( iExtension->iOldItemIndex ); |
664 view->SelectItemL( selection ); |
|
665 |
|
666 TInt decoratedIndex; |
|
667 TBool decorated = iDecorator.DecoratedIndex( decoratedIndex ); |
|
668 if ( decorated && ( selection == decoratedIndex ) ) |
|
669 { |
|
670 TBool accepted = iValue->CreateEditorL(); |
|
671 if ( !accepted ) |
|
672 { |
|
673 break; |
|
674 } |
|
675 } |
|
676 else |
|
677 { |
|
678 iValue->SetCurrentValueIndex( selection ); |
|
679 } |
664 } |
680 } |
665 } |
681 } |
666 |
682 // fall through |
667 case MEikListBoxObserver::EEventItemDoubleClicked: |
683 case MEikListBoxObserver::EEventItemDoubleClicked: |
668 case MEikListBoxObserver::EEventEnterKeyPressed: |
684 case MEikListBoxObserver::EEventEnterKeyPressed: |
669 { |
685 { |
670 // We can't delete the selection list until it's finished |
686 // We can't delete the selection list until it's finished |
671 // processing the event, so call ourselves back and do it when |
687 // processing the event, so call ourselves back and do it when |
1203 __ASSERT_DEBUG(iSelectionList != NULL, Panic(EAknPanicPopupFieldSelectionListDoesntExist)); |
1219 __ASSERT_DEBUG(iSelectionList != NULL, Panic(EAknPanicPopupFieldSelectionListDoesntExist)); |
1204 TBool finished = ETrue; |
1220 TBool finished = ETrue; |
1205 |
1221 |
1206 if (aAccept) |
1222 if (aAccept) |
1207 { |
1223 { |
1208 // get current selection |
1224 if ( iSelectionList->IsHighlightEnabled() ) |
1209 const TInt selection=iSelectionList->CurrentItemIndex(); |
1225 { |
1210 TInt decoratedIndex; |
1226 // get current selection |
1211 TBool decorated = iDecorator.DecoratedIndex(decoratedIndex); |
1227 const TInt selection=iSelectionList->CurrentItemIndex(); |
1212 if (decorated && (selection == decoratedIndex)) |
1228 TInt decoratedIndex; |
1213 { |
1229 TBool decorated = iDecorator.DecoratedIndex(decoratedIndex); |
1214 TBool accepted = iValue->CreateEditorL(); |
1230 if (decorated && (selection == decoratedIndex)) |
1215 if (!accepted) |
1231 { |
1216 { |
1232 TBool accepted = iValue->CreateEditorL(); |
1217 // dialog was cancelled, so popup list must remain |
1233 if (!accepted) |
1218 finished = EFalse; |
1234 { |
1219 } |
1235 // dialog was cancelled, so popup list must remain |
1220 } |
1236 finished = EFalse; |
1221 else |
1237 } |
1222 iValue->SetCurrentValueIndex(selection); |
1238 } |
1223 } |
1239 else |
1224 |
1240 { |
|
1241 iValue->SetCurrentValueIndex(selection); |
|
1242 } |
|
1243 } |
|
1244 } |
1225 if (finished) |
1245 if (finished) |
1226 { |
1246 { |
1227 delete iCba; |
1247 delete iCba; |
1228 iCba = NULL; |
1248 iCba = NULL; |
1229 DestroyPopout(); |
1249 DestroyPopout(); |