Reputation: 6707
TPopup menu layouts (Icons/Bitmaps, text alignment, three dots...) are reversed from left-to-right to right-to-left after migrating my source code from D7 to D2007. My system language is English.
I tried to add the new BiDiMode setting like this, but it does not seem to fix the issue. Any ideas, how to get the menu icons back to the left side?
The popup menu is created like this, without a reference to a form:
Popup = TpopupMenu.create(nil);
Popup.BiDiMode := bdLeftToRight;
StatisticsItem.Caption := 'menuitemtest1...';
StatisticsItem.BitMap.Handle := loadbitmap(Hinstance, 'STATISTICS');
StatisticsItem.OnClick := xxx
PopUp.Items.insert(0,StatisticsItem);
StatisticsItem2 := TMenuItem.Create(Popup);
StatisticsItem2.Caption := 'menuitemtest2...';
ETC...
TrayIcon.PopupMenu := Popup;
Upvotes: 1
Views: 115
Reputation: 4740
The problem you are describing is not in the sample code. PopupMenu.BidiMode
can be used to set the direction of the popup menu. I verified this in Delphi 2009 (I don't have 2007). So if you explicitly set this property and it is not honored, chances are that some other code messes with it.
What you can do is set SysLocale.MiddleEast := False;
. This should disable right to left completely. But it might be better to research this a little further.
Enable debug dcu's in your project. Open the unit Menus.pas
and set a breakpoint in TMenu.DoBiDiModeChanged
. This should tell you where the direction of the menu changes. The line where MenuItemInfo.fType
is assigned should be of special interest to you.
Upvotes: 2