183 views
in GUI Development by

Hi

I encounter a problem when I enter or delete a character in Text Editor.

1.When I open the TextEditor, and enter the string of "12345%6789", then click the cursor position between the '5' and '%'.

As shown in the figure below

 

2.When the  cursor position is between the '5' and '%', then click the delete key. What I'm looking for is the string "1234%6789",but the result is the "12346789".

 

The version of Embedded Wizard I am using is 9.30.

Can you help me to resolve the question? How to do? Thank you very much!

 

Regards

Sancia

1 Answer

0 votes
by
Hello Sancia,

I confirm your observation. It seems to be a bug in the Text Editor template. I will evaluate the cause of the problem and provide you with instructions how to fix the issue.

Best regards

Paul Banach
by

Hello Sancia,

I think, I was able to find the cause of the error. The % sign, similar to ^ and ~ are special characters. To display them the character has to be prefixed explicitly by an additional % escape sign. This is handled correctly in the Text Editor component so far. However, as we enhanced Embedded Wizard by BIDI-Text (bidirectional) support, the methods responsible for position calculation were adapted. We overseen that the Text Editor component template also depends on the methods and we didn't update the Text Editor component template. We will fix this issue officially in the next version.

To continue working with your version (9.10 to 11.00) you would need to modify the Text Editor component as explained below. This is ok, since the Text Editor component is created from a template so you can edit it.

Step 1: The correction implies that you will add following code to the existing Text Editor implementation. Thus, as first step copy this code section:

var char  ch = Text.String[ newCaretIndex ];

// The caret points to a special control sign? In this case the sign comes
// together with the preceding '%' escape sign - otherwise the user couldn't
// see the sign. Adjust the caret position to refer the escape sign.
if (( ch == '^' ) || ( ch == '~' ) || ( ch == '%' ))
  newCaretIndex = newCaretIndex - 1;

Step 2: In the method onCursorKey paste the above code section as shown with the highlighted code lines:

Step 3: In the method onPressTouch paste the above code section as shown with the highlighted code lines:

Step 4: Do the same in the method onDragTouch:

I hope it solves the issue. Can you please verify it?

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...