Re: Entering text backwards



Thanks. I'm always surprised by what turns out to be easy, and what is
difficult or impossible. I really thought there would just be some sort of
setting that I could set, and it would just work.

Unfortunately, the solution is not workable for my particular problem. I'm
trying to enter Canaanite text, but really I'm trying to do more than that.
The program is for linguists. I'm trying to enter text in any language the
user decides upon, which might include all sorts of "dead languages" like
Canannite, along with constructed languages, like Tolkein's languages or
Klingon.

The variation in text, keyboards, and font mappings prevent me from doing
anything that maps specific characters.

"durstin" wrote:

> There may be some clever cultural trick available, but you could handle the
> keypress event and do your own string construction, something along the
> following. You would probably want to create your own subclassed textbox
> control:
>
> private void textBox1_KeyPress(object sender,
> System.Windows.Forms.KeyPressEventArgs e)
>
> {
>
> TextBox txtBox = (TextBox) sender;
>
> string text = txtBox.Text;
>
> int selectionStart = txtBox.SelectionStart;
>
>
> // Alphanumerics
>
> if (33 <= e.KeyChar && e.KeyChar <= 122)
>
> {
>
> if (txtBox.SelectionStart == 0)
>
> text = e.KeyChar + text;
>
> else
>
> {
>
> text = text.Substring(0, selectionStart) + e.KeyChar +
> text.Substring(selectionStart , text.Length - selectionStart);
>
> }
>
> e.Handled = true;
>
> }
>
>
> // Backspace -- treat as Delete
>
> // unless some text is selected, in which case it behaves as normal
>
> else if (e.KeyChar == 8 && txtBox.SelectionLength == 0 && selectionStart <
> text.Length)
>
> {
>
> text = text.Remove(selectionStart, 1);
>
> e.Handled = true;
>
> }
>
>
> // Delete -- doesn't get captured by KeyPress
>
> txtBox.Text = text;
>
> // return character entry point to original location
>
> txtBox.SelectionStart = selectionStart;
>
> }
>
>
>
> "David" <David@xxxxxxxxxxxxx> wrote in message
> news:16E43C83-AF2B-4A18-A2D8-AFAA9C58BF42@xxxxxxxxxxxxxxxx
> > I want to enter text in a textbox, but have it appear right to left. I
> want
> > to keep the English cultural settings to do it. When I select RightToLeft
> =
> > yes, and TextAlign=left, the text ends up right aligned. The entry cursor
> > appears to the left of previously entered text, but when I actually type
> the
> > text, it is entered on the right side.
> >
> > (I'm actually not trying to enter English text. I'm trying to enter
> > Canaanite text. But since the operating system doesn't recognize
> Canaanite
> > as a cultural setting, I am keeping the English setting, and using a font
> > that maps English characters to Canaanite glyphs. So what I'm really
> trying
> > to do is to have the text behave as if I were entering Hebrew, but since
> the
> > font maps to the ascii characters, I can't change to Hebrew settings,
> because
> > I want the keyboard mapping to remain unchanged.)
>
>
>
.



Relevant Pages

  • Re: Entering text backwards
    ... You would probably want to create your own subclassed textbox ... text.Substring(selectionStart, text.Length - selectionStart); ... > to keep the English cultural settings to do it. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • MFC application textbox input overflow on Japanese Windows 2000
    ... My MFC application contains a dialog and a single line textbox of size ... When the application run on English Wndows XP, ... user type long English sentence to the textbox, ... last 30 characters. ...
    (microsoft.public.vc.mfc)
  • Re: Unicode Support
    ... consider:)...but, you know, a file is still just a "stream of characters" ... "escape sequence" but accessing an ordinary ASCII character) are considered ... English, while all your identifiers are in "Romanji" Japanese or something ... NASM appears already to do so with strings and comments in ...
    (alt.lang.asm)
  • Re: Italian language in PIAZZA
    ... it would be hard to write it with the Italian ... characters speaking any kind of English. ... done is simply make Fabrizio's English a little better. ... This isn't like throwing in a little foreign language number, ...
    (rec.arts.theatre.musicals)
  • Re: Italian language in PIAZZA
    ... speaks to the audience in English, ... My trouble with the show's use of Italian is that it *doesn't* bring us ... closer to the story or characters. ...
    (rec.arts.theatre.musicals)