javauis/lcdui_akn/lcdui/src/CMIDTextFieldItem.cpp
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
--- a/javauis/lcdui_akn/lcdui/src/CMIDTextFieldItem.cpp	Wed Sep 15 12:05:25 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDTextFieldItem.cpp	Wed Oct 13 14:23:59 2010 +0300
@@ -326,6 +326,7 @@
 
 void CMIDTextFieldItem::FocusChanged(TDrawNow aDrawNow)
 {
+    TBool cursorVisibility = EFalse;
     if (IsFocused())
     {
         // Setting focus to iTextField changes the cursor visibility. This might cause
@@ -335,17 +336,20 @@
         iTextField->AddFlagToUserFlags(CEikEdwin::EAvkonDisableCursor);
         iTextField->SetFocus(ETrue);
         iTextField->RemoveFlagFromUserFlags(CEikEdwin::EAvkonDisableCursor);
-        SetCursorVisibility(IsVisible());
+        cursorVisibility = IsVisible();
     }
     else
     {
         iTextField->SetFocus(EFalse);
+        cursorVisibility = EFalse;
     }
 
     CMIDControlItem::FocusChanged(aDrawNow);
     // DoLayout and change text color when focused
     SizeChanged();
     TRAP_IGNORE(UpdateTextColorsL());
+
+    SetCursorVisibility(cursorVisibility);
 }
 
 void CMIDTextFieldItem::HandleCurrentL(TBool aCurrent)
@@ -386,7 +390,7 @@
 {
     if (AknLayoutUtils::PenEnabled())
     {
-        if (!iForm->PhysicsScrolling())
+        if (!iForm->PhysicsScrolling() && !iTextField->IsReadOnly())
         {
             SetCursorVisibility(ETrue);
         }
@@ -667,6 +671,11 @@
         TCursor::TVisibility textCursor =
             aVisible ? TCursor::EFCursorFlashing : TCursor::EFCursorInvisible;
 
+        if (iTextField->IsReadOnly())
+        {
+            textCursor = TCursor::EFCursorInvisible;
+        }
+
         // lineCursor is not used in TextField, so it is set to TCursor::EFCursorInvisible always
         TRAP_IGNORE(iTextField->TextView()->SetCursorVisibilityL(TCursor::EFCursorInvisible,
                     textCursor));
@@ -675,7 +684,7 @@
 
 void CMIDTextFieldItem::UpdateTextColorsL()
 {
-    if (iTextField)
+    if (iTextField && !iTextField->IsReadOnly())
     {
         // Set color for content text according to item highlight
         // (logical color constants are defined in lcdui.h)