473,382 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

MessageBox displaying text LTR in Hebrew environment


I have a program which runs in multiple languages. The problem is that
message boxes displayed when I run my program on Hebrew still have
left-to-right reading order. This is Hebrew locale on an English Windows
machine. I know there is a constant MB_RTLREADING or osmething, but I cannot
use that as the program has to run in a number of different languages.
Shouldn't it automatically change to RTL if I change the locale to Hebrew?
Any ideas/suggestions would be most welcome.

Thanks.

-Jaya
Jan 17 '06 #1
4 2218
Hi Jaya!
I have a program which runs in multiple languages. The problem is that
message boxes displayed when I run my program on Hebrew still have
left-to-right reading order.


Normally the text is displayed correctly even on an english windows!
Are you really sure that the text is in the right order?

A better newgroup might also be:
microsoft.public.dotnet.internationalization

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Jan 17 '06 #2
> Shouldn't it automatically change to RTL if I change the locale to Hebrew?
And "change the locale to Hebrew" is too vague.
You can set the thread locale, user locale, system locale, UI locale, input
locale.
And, anyway, the answer is no. Because then all applications, localized into
Hebrew or not, will be RTL.

I know there is a constant MB_RTLREADING or osmething, but I cannot
use that as the program has to run in a number of different languages.

MB_RTLREADING is the solution. And you can use it.
Just write a wrapper function.

Transform this:
MessageBox( hwnd, text, title, flags );
into this:
MessageBox( hwnd, text, title, AdjustRTLFlags(flags) );

And your AdjustRTLFlags can do something like this:

UINT AdjustRTLFlags( UINT flags ) {
static int nIsRTL = -1;

switch( bIsRTL ) {
case -1:
bIsRTL = GetRTL();
break;
case 0:
flags &= ~MB_RTLREADING;
break;
case 1:
flags |= MB_RTLREADING;
break;
default:
assert(1);
}

return flags;
}

GetRTL() can get the RTL setting from resources, registry, etc.

Or you can global search-replace MessageBox with MessageBoxSmartRTL, and
MessageBoxSmartRTL does the same "magic" as the function above.

--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Jan 18 '06 #3
Jaya wrote:
I have a program which runs in multiple languages. The problem is that
message boxes displayed when I run my program on Hebrew still have
left-to-right reading order. This is Hebrew locale on an English Windows
machine. I know there is a constant MB_RTLREADING or osmething, but I cannot
use that as the program has to run in a number of different languages.
Shouldn't it automatically change to RTL if I change the locale to Hebrew?
Any ideas/suggestions would be most welcome.


To get Hebrew to work in English Windows, you need to go Control
Panel->Regional and Language Options->Languages Tab->Tick install files
for complex script and right-to-left languages (including Thai). Once
you've done that, the APIs work fine.

Tom
Jan 18 '06 #4
Hi Jaya!
I have a program which runs in multiple languages. The problem is that
message boxes displayed when I run my program on Hebrew still have
left-to-right reading order. This is Hebrew locale on an English Windows
machine. I know there is a constant MB_RTLREADING or osmething, but I cannot
use that as the program has to run in a number of different languages.
Shouldn't it automatically change to RTL if I change the locale to Hebrew?
Any ideas/suggestions would be most welcome.


I think Michael S. Kaplan has read this post and added a blog-entry
about this:

See: Just when you think you know a function...
http://blogs.msdn.com/michkap/archiv...19/514656.aspx

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Jan 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Rich Tasker | last post by:
I have a strange situation. A simple call to MessageBox.Show("XXX", "YYY") does not display the message in the messagebox with a visible font. Based on the content of the messagebox, the box...
1
by: Yoshitha | last post by:
hi I have datalist control in my ASP.NET application the problem here is i have used a textbox with multiline true propertly when i enter data like "fdjsfhjksdhfjsdfhsdjhfsdfhsdjfhsd...
1
by: kannan | last post by:
hi, It might be the simple question. I am concatinating two string and displaying in messagebox. Ex: MessageBox.show(string.Concat("The following validation(s) failed:\n", arg.DisplayMessage))...
3
by: Sin | last post by:
I'm currently evaluating VC.NET as the new platform for the company I work for and things are looking grim... We're up against another IDE which took me about 5 minutes to master and I've been...
0
by: Gidi | last post by:
Hi, i'm writing this question again, since i didn't get an answer in the reply i wrote, i hope it's ok. My user default language is hebrew and in some specific TextBoxs i want that the...
20
by: Peter E. Granger | last post by:
I'm having a strange problem (or at least it seems strange to me) trying to display a MessageBox in a VC++ .NET forms application. If I put the call to MessageBox::Show in the form's .h file, it...
0
by: Eitan | last post by:
Hello, I have a ValidationSummary. My language is Hebrew. How can I control ValidationSummary, so it will fits the language Hebrew. (It should be read as dir="rtl" / right to left reading. Can...
2
by: Asaf | last post by:
Hi, Below is a calss with function I gathered from a news group that uses GetCharacterPlacement API to reorder text. I have mixed text Hebrew/English and the function reorders the Hebrew text. ...
16
by: Al Santino | last post by:
Hi, It appears displaying a messagebox in a validating event will cancel the subsequent event. In the program below, button 2's click event doesn't fire if you open a dialog box in button 1's...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.