View Issue Details

IDProjectCategoryView StatusLast Update
0019671LazarusLCLpublic2017-11-19 10:24
ReporterAvishai Assigned To 
Status acknowledgedResolutionopen 
Product Version0.9.31 (SVN) 
Summary0019671: TStatusBar does not support BiDiMode
DescriptionTStatusBar does not support BiDiMode. It does not Right-Align the Panels and does not display RightToLeft Text correctly even when the Parent.BiDiMode:= bdRightToLeft.
Fixed in Revision
Attached Files


related to 0029593 confirmed TStatusBar SizeGrip is incompatible with BiDiMode? 
child of 0019303 acknowledged BiDi meta issue 


Bart Broersma

2013-12-25 18:59

developer   ~0072044

On Windows part of the problem is in

procedure UpdateStatusBarPanelWidths(const StatusBar: TStatusBar);
which does
Windows.SendMessage(StatusBar.Handle, SB_SETPARTS, StatusBar.Panels.Count, LPARAM(Rights));

Rights is an array of integers indicating the position, in client coordinates, of the right edge of the corresponding part.
It seems that this API always expects the positions to be in ascending order, in effect meaning that panels will always be Left to Right.
If you supply the positions in descending order only the first panel will be drawn.


2013-12-25 20:29

reporter   ~0072047

On Windows to solve most of the problems with RightToLeft:

uses LclType, Windows;

TForm1 = class(TForm)
  StatusBar1: TStatusBar;
  procedure CreateParams(var Params : TCreateParams); override;

procedure TForm1.CreateParams(var Params : TCreateParams);
  inherited CreateParams(Params);
  Params.ExStyle:= Params.ExStyle or WS_EX_LAYOUTRTL;

But you have to disable Themes because of a Lazarus bug that corrupts TCanvas if Themes are enabled. Delphi doesn't have this bug. For my own use I have disabled Themes in Win32Themes.pas but it can't be done for other users.

function TWin32ThemeServices.UseThemes: Boolean;
  //Result := UxTheme.UseThemes and (GetFileVersion(comctl32) >= ComCtlVersionIE6);
  Result:= False; // Added by Avishai

Bart Broersma

2013-12-26 01:06

developer (2,889 bytes)

Bart Broersma

2013-12-26 01:32

developer   ~0072049

Please try r43594 (without your local "bidi alterations").


2013-12-26 04:53

reporter   ~0072050

Per your instructions I used a "Pure Lazarus" installation to test r43594.

TStatusBar is greatly improved for RightToLeft, but there is no gap between the Text and Panel edge. Also the 'Grab Corner' is still on the Right and drawn LeftToRight.

Even if you manage to get TStatusBar to be perfect using only BiDiMode, it only fixes 1 component and there are many components that still need to be fixed. I keep talking about using the CreateParams approach because I have seen how well it works in Delphi and in MS Visual Studio. It fixes *almost* all components without any addition code changes. In fact, you could strip out a lot of RightToLeft handling code. Plus this is the way that MS designed Windows to handle RightToLeft.

If the developers have decided not to take this approach it is certainly their right to do so. Just let me know if this is the case and I will stop talking about it.

Bart Broersma

2013-12-26 15:17

developer   ~0072053

> Just let me know if this is the case and I will stop talking about it.

I don't have clue.


2013-12-26 15:32

reporter   ~0072056

Haha! OK thanks.

Bart Broersma

2013-12-30 18:22

developer   ~0072115

1.2 is way to optimistic for BiDi.

Bart Broersma

2014-09-19 08:47

developer   ~0077389

This needs to be fixed in the WS code (see meta-issue).
Current workaround should be reverted then.

Issue History

Date Modified Username Field Change
2011-07-03 11:28 Avishai New Issue
2011-07-03 11:28 Avishai Widgetset => Win32/Win64
2011-07-03 11:29 Avishai Tag Attached: bidi
2011-10-06 12:12 Vincent Snijders LazTarget => 1.2
2011-10-06 12:12 Vincent Snijders Status new => acknowledged
2011-10-06 12:12 Vincent Snijders Target Version => 1.2.0
2013-12-25 18:59 Bart Broersma Note Added: 0072044
2013-12-25 19:08 Bart Broersma Status acknowledged => confirmed
2013-12-25 20:29 Avishai Note Added: 0072047
2013-12-26 01:06 Bart Broersma File Added:
2013-12-26 01:32 Bart Broersma Note Added: 0072049
2013-12-26 01:32 Bart Broersma Assigned To => Bart Broersma
2013-12-26 01:32 Bart Broersma Status confirmed => feedback
2013-12-26 04:53 Avishai Note Added: 0072050
2013-12-26 04:53 Avishai Status feedback => assigned
2013-12-26 15:17 Bart Broersma Note Added: 0072053
2013-12-26 15:32 Avishai Note Added: 0072056
2013-12-27 16:02 Bart Broersma Relationship added related to 0019303
2013-12-30 18:22 Bart Broersma LazTarget 1.2 => 1.4
2013-12-30 18:22 Bart Broersma Note Added: 0072115
2013-12-30 18:22 Bart Broersma Target Version 1.2.0 => 1.4
2014-09-10 14:33 Juha Manninen LazTarget 1.4 => -
2014-09-10 14:33 Juha Manninen Target Version 1.4 =>
2014-09-19 08:46 Bart Broersma Assigned To Bart Broersma =>
2014-09-19 08:47 Bart Broersma Note Added: 0077389
2014-09-19 08:47 Bart Broersma Status assigned => acknowledged
2016-04-26 22:42 Bart Broersma Relationship added related to 0029593
2017-11-19 10:24 Juha Manninen Relationship replaced child of 0019303