687 |
686 |
688 if (Size() < iMaxSize) |
687 if (Size() < iMaxSize) |
689 { |
688 { |
690 SetCursorPositionL(cursorPos + 1); |
689 SetCursorPositionL(cursorPos + 1); |
691 } |
690 } |
692 else if (cursorPos == (iMaxSize - 1) && cursorPos == textLength && scanCode==EStdKeyFullStop) |
691 else if (cursorPos == (iMaxSize - 1) && cursorPos == textLength && |
|
692 (scanCode == EStdKeyFullStop || scanCode == EStdKeyMinus)) |
693 { |
693 { |
694 SetCursorPositionL(iMaxSize); |
694 SetCursorPositionL(iMaxSize); |
695 } |
695 } |
696 |
696 |
697 HandleTextUpdateL(MEikEdwinObserver::EEventTextUpdate); |
697 HandleTextUpdateL(MEikEdwinObserver::EEventTextUpdate); |
766 TBool isFocused = IsFocused(); |
766 TBool isFocused = IsFocused(); |
767 |
767 |
768 // If there is no focus textbox should not consume keys |
768 // If there is no focus textbox should not consume keys |
769 if (isFocused) |
769 if (isFocused) |
770 { |
770 { |
771 //Error tone playing case2: |
771 // Error tone playing case2: |
772 //Play error tone if TextBox/TextField is read-only or maximum length has been reached. |
772 // Play error tone if TextBox/TextField is read-only or maximum length has been reached. |
773 //Here is handling of full keyboard keys(NOT 0...9) and all virtual keyboard keys. |
773 // Here is handling of full keyboard keys(NOT 0...9) and all virtual keyboard keys |
774 //(Note: Virtual keyboard sends only EEventKey type events, not up or down events) |
774 // (camera and menu key not included). |
775 //(Note: Error tone is played when there is no text to be replaced i.e. no text has been painted) |
775 // (Note: Virtual keyboard sends only EEventKey type events, not up or down events) |
776 if (!iEdwinUtils->IsNavigationKey(aKeyEvent) && !iEdwinUtils->IsHotKeyL(aKeyEvent, iCoeEnv) && !aKeyEvent.iCode == EKeyYes && |
776 // (Note: Error tone is played when there is no text to be replaced i.e. no text has been painted) |
777 (!iKeyEventsPending || (scanCode < KKeyQwerty0 || scanCode > KKeyQwerty9))) |
777 if (!iEdwinUtils->IsNavigationKey(aKeyEvent) && !iEdwinUtils->IsHotKeyL(aKeyEvent, iCoeEnv) && aKeyEvent.iCode != EKeyYes && |
|
778 (!iKeyEventsPending || (scanCode < KKeyQwerty0 || scanCode > KKeyQwerty9)) && |
|
779 (aKeyEvent.iCode != EKeyApplication0 && scanCode != EStdKeyApplication0 && |
|
780 aKeyEvent.iCode != EKeyApplication19 && scanCode != EStdKeyApplication19)) |
778 { |
781 { |
779 if (iEditor->IsReadOnly() || (Size() >= iMaxSize && aKeyEvent.iCode != EKeyBackspace)) |
782 if (iEditor->IsReadOnly() || (Size() >= iMaxSize && aKeyEvent.iCode != EKeyBackspace)) |
780 { |
783 { |
781 //SelectionLength() > 0 if text has been selected/painted |
784 //SelectionLength() > 0 if text has been selected/painted |
782 if (iEditor->SelectionLength() == 0) |
785 if (iEditor->SelectionLength() == 0) |
833 CPlainText* res = iEditor->Text(); |
836 CPlainText* res = iEditor->Text(); |
834 |
837 |
835 if (res && TChar(aKeyEvent.iCode) == TChar('-') && |
838 if (res && TChar(aKeyEvent.iCode) == TChar('-') && |
836 Size() < iMaxSize) |
839 Size() < iMaxSize) |
837 { |
840 { |
|
841 TInt textLength = Size(); |
838 res->InsertL(GetCaretPosition(), KMinusChar); |
842 res->InsertL(GetCaretPosition(), KMinusChar); |
839 // notify editor about the text changes |
843 // notify editor about the text changes |
840 iEditor->HandleTextChangedL(); |
844 iEditor->HandleTextChangedL(); |
|
845 TInt cursorPos = GetCaretPosition(); |
841 |
846 |
842 if (Size() < iMaxSize) |
847 if (Size() < iMaxSize) |
843 { |
848 { |
844 SetCursorPositionL(GetCaretPosition() + 1); |
849 SetCursorPositionL(GetCaretPosition() + 1); |
845 } |
850 } |
846 |
851 else if (cursorPos == (iMaxSize - 1) && cursorPos == textLength) |
|
852 |
|
853 { |
|
854 SetCursorPositionL(iMaxSize); |
|
855 } |
847 //Prevent changes that would result in an illegal string |
856 //Prevent changes that would result in an illegal string |
848 HandleTextUpdateL(MEikEdwinObserver::EEventTextUpdate); |
857 HandleTextUpdateL(MEikEdwinObserver::EEventTextUpdate); |
849 } |
858 } |
850 } |
859 } |
851 |
860 |
1548 * screen dynamic resolution change. |
1565 * screen dynamic resolution change. |
1549 */ |
1566 */ |
1550 void CMIDTextBoxQueryDialog::HandleResourceChange(TInt aType) |
1567 void CMIDTextBoxQueryDialog::HandleResourceChange(TInt aType) |
1551 { |
1568 { |
1552 CAknTextQueryDialog::HandleResourceChange(aType); |
1569 CAknTextQueryDialog::HandleResourceChange(aType); |
1553 if (aType == KEikDynamicLayoutVariantSwitch || |
1570 TRAP_IGNORE(UpdateScrollBarPositionL()); |
1554 aType == KEikColorResourceChange || aType == KAknsMessageSkinChange || |
|
1555 aType == KUidValueCoeColorSchemeChangeEvent) |
|
1556 { |
|
1557 TRAP_IGNORE(UpdateScrollBarPositionL()); |
|
1558 } |
|
1559 } |
1571 } |
1560 |
1572 |
1561 /* UpdateScrollBarPositionL |
1573 /* UpdateScrollBarPositionL |
1562 * |
1574 * |
1563 * This method is called for placing scrollbar to correct place in edwin |
1575 * This method is called for placing scrollbar to correct place in edwin |
1564 */ |
1576 */ |
1565 void CMIDTextBoxQueryDialog::UpdateScrollBarPositionL() |
1577 void CMIDTextBoxQueryDialog::UpdateScrollBarPositionL() |
1566 { |
1578 { |
1567 if(iEditor && iEditor->TextLayout()) |
1579 if (iEditor && iEditor->TextLayout()) |
1568 { |
1580 { |
1569 TInt numLines = iEditor->TextLayout()->NumFormattedLines(); |
1581 TInt numLines = iEditor->TextLayout()->NumFormattedLines(); |
1570 if(numLines == iEditor->MaximumHeightInLines()) |
1582 if (numLines == iEditor->MaximumHeightInLines()) |
1571 { |
1583 { |
1572 if(iEditor->ScrollBarFrame()) |
1584 if (iEditor->ScrollBarFrame()) |
1573 { |
1585 { |
1574 iEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); |
1586 iEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); |
1575 } |
1587 } |
1576 } |
1588 } |
1577 else if(numLines > iEditor->MaximumHeightInLines()) |
1589 else if (numLines > iEditor->MaximumHeightInLines()) |
1578 { |
1590 { |
1579 if(!iEditor->ScrollBarFrame()) |
1591 if (!iEditor->ScrollBarFrame()) |
1580 { |
1592 { |
1581 iEditor->CreatePreAllocatedScrollBarFrameL(); |
1593 iEditor->CreatePreAllocatedScrollBarFrameL(); |
1582 iEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
1594 iEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); |
1583 } |
1595 } |
1584 TRect editorRect = iEditor->Rect(); |
1596 TRect editorRect = iEditor->Rect(); |
1585 if(iEditor->ScrollBarFrame()->VerticalScrollBar()) |
1597 if (iEditor->ScrollBarFrame()->VerticalScrollBar()) |
1586 { |
1598 { |
1587 editorRect.SetWidth(editorRect.Width() - iEditor->ScrollBarFrame()->VerticalScrollBar()->ScrollBarBreadth()); |
1599 editorRect.SetWidth(editorRect.Width() - iEditor->ScrollBarFrame()->VerticalScrollBar()->ScrollBarBreadth()); |
1588 iEditor->SetRect(editorRect); |
1600 iEditor->SetRect(editorRect); |
1589 } |
1601 } |
1590 } |
1602 } |
1591 } |
1603 } |
1592 } |
1604 } |
|
1605 |
|
1606 void CMIDTextBoxQueryDialog::PreLayoutDynInitL() |
|
1607 { |
|
1608 CAknQueryDialog::PreLayoutDynInitL(); |
|
1609 UpdateLeftSoftKeyL(); |
|
1610 } |
1593 // End of file |
1611 // End of file |