I wrote a program that accepts and outputs Hebrew (i.e. right-to-left) text.
In lieu of a Hebrew keyboard, the program has 22 buttons that allow the typing of Hebrew letters into one of the text boxes. (This has nothing to do with the problem, I think.)
This program works fine under Windows using Microsoft .NET and Mono.
However, in Mac OS X and Linux all Hebrew text is the wrong way around and typing Hebrew text also adds letters to the right of existing text rather than to the left.
I figure I can catch all “text changed” events of all text fields and reverse those strings before replacing the original textField.text with the new string. But since there are about 100 text fields on the form, this would be tiresome.
Is there a more general event I should use or another solution I overlooked?
(Testing for the underlying OS is easy since Mono returns a PlatformID of PlatformID.Unix on Mac OS X as well as Linux.)
Are you basically going to do the same thing for each text box? If so, write one method to do it, then hook it up to all the “text change” events by filtering the
Controlscollection to just TextBoxes, e.g. withControls.OfType<TextBox>().Use the “sender” parameter to work out which text box you’re interested in. Shouldn’t be too hard:
(You’d then need to write
ReverseText, but I assume you already have this. CallingToCharArrayand reversing the contents is a simple way of doing it, but may have issues for you in terms of combining characters etc.)