PDA

View Full Version : Bug entering MBCS characters in Objective Edit



frankk513
07-14-2016, 01:15 PM
We're using OE (Stingray Studio 11.2) with Visual Studio 2012 in our product to display an editor window, but users are reporting issues entering MBCS characters (Chinese, Japanese, etc),
under certain conditions - they display OK on the first page of a document, but if you scroll down to other 'pages', i.e. to the end of the
document, the characters won't display until the Enter key is pressed. I was able to reproduce the issue using the Samples\Edit\1stEdit code.

Reproduction steps:
- Go into Windows Control Panel -> Region and Language -> Keyboards and Languages tab -> Change keyboards... -> Add Japanese keyboard
- Bring up your app that contains an Objective Edit window, make sure it has enough lines that it must be scrolled to display the end of the document (about 3-4 pages).
- On the Language bar in the windows task bar, change the keyboard from EN to JP, the press Alt+` (key with tilde to the left of the '1' key).
- At the top of the document, type e, de, me, etc. to see how entering the MBCS characters work. They should display immediately (and for the 'de' and 'me' combinations, they change symbols when the 'e' is pressed). You must press Enter to complete the input.
- Now scroll down to the bottom of the document, and repeat the keystrokes. The characters do not display when pressing the keys, they only appear after pressing enter.

frankk513
07-20-2016, 12:47 PM
This can be fixed by modifying the file Src\Edit\SECEditSrc\SECEditController.cpp

In the function SECEditController::OnImeStartComposition(WPARAM wParam, LPARAM lParam)

After the lines:

// Get the current point and rect for the caret and window
CPoint pt = LineColToPoint(m_lcCaret);
// Use custom LPtoDP
pVp->LPtoDP(&pt);
CRect rc = pVp->GetLogBounds();

add:
pVp->LPtoDP(&rc); //this also needs to be in device coordinates, same as the value in 'pt' above