View Issue Details

IDProjectCategoryView StatusLast Update
0025450LazarusLCLpublic2013-12-25 01:07
ReporterAvishaiAssigned ToMaxim Ganetsky 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version1.4 
Summary0025450: Text direction in TCheckList is incorrect when BiDiMode<>bdLeftToRight
DescriptionWhen BiDiMode<>bdLeftToRight Everything looks as it should except the Text. The Text is LeftToRight.
TagsNo tags attached.
Fixed in Revision43587
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • TextFlags_DT_RTLREADING.patch (616 bytes)
    Index: lcl/interfaces/win32/win32wschecklst.pp
    ===================================================================
    --- lcl/interfaces/win32/win32wschecklst.pp	(revision 43586)
    +++ lcl/interfaces/win32/win32wschecklst.pp	(working copy)
    @@ -219,7 +219,7 @@
         // draw text
         if CheckListBox.UseRightToLeftAlignment then begin
           TextRect.Right := TextRect.Right - 2;
    -      TextFlags := DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX or DT_RIGHT;
    +      TextFlags := DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX or DT_RIGHT or DT_RTLREADING;
         end
         else begin
           TextRect.Left := TextRect.Left + 2;
    
  • CheckBoxes.PNG (4,727 bytes)
    CheckBoxes.PNG (4,727 bytes)
  • checklistbox-bidi.png (28,465 bytes)
    checklistbox-bidi.png (28,465 bytes)

Relationships

related to 0025408 closedMaxim Ganetsky BiDiMode and FlipChildren issues with TRadioGroup, TCheckGroup and TCheckedListbox 
related to 0019303 acknowledged BiDi meta issue 

Activities

Reinier Olislagers

2013-12-23 11:23

developer   ~0072015

Please help the devs to help you by giving useful info.

What do you mean "latest SVN"? Please specify an except revision number.

How do you know it is "latest SVN"? Have you tested the revision before it? If not, please specify which revision you used that did work, thanks.

Avishai

2013-12-23 11:34

reporter   ~0072016

It worked in Revision 43539 but it is broken in Lazarus Revision: 43585

Bart Broersma

2013-12-23 13:10

developer   ~0072018

Can you disect this range so you get the actual revision that broke it?

Avishai

2013-12-23 13:44

reporter   ~0072019

I don't know how to do that. I know that a patch was applied recently. Maybe it has something to do with issue 0025408

wp

2013-12-23 14:35

developer   ~0072020

For my understanding: You say the patch "broke" BiDi for TCheckListbox. I think BiDi was not working before 0025408, the patch only did not fix text writing direction.

Is that correct?

Bart Broersma

2013-12-23 16:36

developer   ~0072021

Last edited: 2013-12-23 16:37

View 2 revisions

> I don't know how to do that

It's easy, but takes some time.

Take the last revision that worked (you say: 43539)
Take the first revision you noticed was broken (you say: 43585)
Now take the middle of those two: 43562
Do
make clean
svn up -r 43562

Rebuild Lazarus, see if problem has gone, if so the problem is between 43539 and 43526, if not the problem is between 43526 and 43585

You continue this until you find the revison that broke it.
It will take no more then 10 svn up's to disect through 1024 (2^10) revisions.
You need only 46 revisions, so you should be fine with at most 6 times this process.

Maxim Ganetsky

2013-12-23 21:07

developer   ~0072023

@Bart: this is not needed. Avishai probably means r43576. But this revision doesn't change anything about text direction. He needs to answer wp's question.

Maxim Ganetsky

2013-12-23 22:08

developer  

TextFlags_DT_RTLREADING.patch (616 bytes)
Index: lcl/interfaces/win32/win32wschecklst.pp
===================================================================
--- lcl/interfaces/win32/win32wschecklst.pp	(revision 43586)
+++ lcl/interfaces/win32/win32wschecklst.pp	(working copy)
@@ -219,7 +219,7 @@
     // draw text
     if CheckListBox.UseRightToLeftAlignment then begin
       TextRect.Right := TextRect.Right - 2;
-      TextFlags := DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX or DT_RIGHT;
+      TextFlags := DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX or DT_RIGHT or DT_RTLREADING;
     end
     else begin
       TextRect.Left := TextRect.Left + 2;

Maxim Ganetsky

2013-12-23 22:10

developer   ~0072025

@Avishai, please answer wp's question.

@All: please test attached patch, maybe it solves this issue.

Avishai

2013-12-23 23:46

reporter   ~0072028

Last edited: 2013-12-23 23:49

View 2 revisions

Maybe I was wrong about it having worked in the past. It din't mirror before so it couldn't be uses in R2L apps and I didn't look at it often.

Anyway the text direction is incorrect for R2L.

wp

2013-12-24 00:18

developer   ~0072029

I tested the patch with the new translation_demo (lazarus/examples/translation) to which I quickly added a CheckListbox. But using the modification or not does not make a difference, even when Hebrew language is selected.

Interestingly, text direction in the Checklistbox is the same as in the checkbox on the same form. So, this would mean that RTL text direction is wrong for TCheckbox as well. Avishai, can you canfirm this? Could you run this demo and check?

Avishai

2013-12-24 00:33

reporter   ~0072030

Last edited: 2013-12-24 00:36

View 2 revisions

TCheckBox and TCheckGroup look correct but TCheckListBox has LeftToRight Text

I added a screen shot show the problem.

Maxim Ganetsky

2013-12-24 01:03

developer   ~0072031

@Avishai: you forgot to attach it.

Avishai

2013-12-24 01:05

reporter  

CheckBoxes.PNG (4,727 bytes)
CheckBoxes.PNG (4,727 bytes)

Avishai

2013-12-24 01:07

reporter   ~0072032

Ha! I did everything except hit the upload button. Sorry about that.

Avishai

2013-12-24 12:24

reporter   ~0072034

I just figured out where I got the idea that TCheckListBox BiDiMode Text worked in the past. It was from playing with Delphi. It works there.

wp

2013-12-24 20:56

developer  

checklistbox-bidi.png (28,465 bytes)
checklistbox-bidi.png (28,465 bytes)

wp

2013-12-24 20:58

developer   ~0072036

Applying Maxim's patch to Win32WSCheckLst.pas I am getting the attached result (checklistbox-bidi.png) which seems to be ok if I take Avishai's screenshot as a reference.

(That BiDi thing is still mysterious to me...)

Avishai

2013-12-24 21:08

reporter   ~0072037

Last edited: 2013-12-24 21:15

View 2 revisions

That looks to be perfect wp.

Basically, all it means is that the punctuation is placed at the left instead of the right when you use Latin chars. Everything else is the same. Of course with a R2L language it means that the chars go R2L. But the BiDirection is because the numbers (1,2,3) go LeftToRight just like in Western languages.

My name would be .iahsivA

Maxim Ganetsky

2013-12-24 23:02

developer   ~0072038

I applied the patch.

Please test and close if OK.

If there will be no problems it will be merged to 1.2 in a couple of days.

Avishai

2013-12-25 01:07

reporter   ~0072039

Awesome guys! Thank you for this. :) Especially thanks to wp.

Issue History

Date Modified Username Field Change
2013-12-23 08:21 Avishai New Issue
2013-12-23 11:23 Reinier Olislagers Note Added: 0072015
2013-12-23 11:34 Avishai Note Added: 0072016
2013-12-23 13:10 Bart Broersma Note Added: 0072018
2013-12-23 13:44 Avishai Note Added: 0072019
2013-12-23 14:35 wp Note Added: 0072020
2013-12-23 16:36 Bart Broersma Note Added: 0072021
2013-12-23 16:37 Bart Broersma Note Edited: 0072021 View Revisions
2013-12-23 21:07 Maxim Ganetsky Note Added: 0072023
2013-12-23 21:07 Maxim Ganetsky Relationship added related to 0025408
2013-12-23 21:09 Maxim Ganetsky LazTarget => -
2013-12-23 21:09 Maxim Ganetsky Summary Latest SVN broke TCheckList BiDiMode => Text direction in TCheckList is incorrect when BiDiMode<>bdLeftToRight
2013-12-23 22:08 Maxim Ganetsky File Added: TextFlags_DT_RTLREADING.patch
2013-12-23 22:10 Maxim Ganetsky Note Added: 0072025
2013-12-23 22:10 Maxim Ganetsky Status new => feedback
2013-12-23 22:11 Maxim Ganetsky Relationship added related to 0019303
2013-12-23 23:46 Avishai Note Added: 0072028
2013-12-23 23:46 Avishai Status feedback => new
2013-12-23 23:49 Avishai Note Edited: 0072028 View Revisions
2013-12-24 00:18 wp Note Added: 0072029
2013-12-24 00:33 Avishai Note Added: 0072030
2013-12-24 00:36 Avishai Note Edited: 0072030 View Revisions
2013-12-24 01:01 Maxim Ganetsky Status new => confirmed
2013-12-24 01:03 Maxim Ganetsky Note Added: 0072031
2013-12-24 01:03 Maxim Ganetsky Assigned To => Maxim Ganetsky
2013-12-24 01:03 Maxim Ganetsky Status confirmed => feedback
2013-12-24 01:03 Maxim Ganetsky Assigned To Maxim Ganetsky =>
2013-12-24 01:05 Avishai File Added: CheckBoxes.PNG
2013-12-24 01:07 Avishai Note Added: 0072032
2013-12-24 01:07 Avishai Status feedback => new
2013-12-24 01:41 Maxim Ganetsky Status new => confirmed
2013-12-24 01:42 Maxim Ganetsky Status confirmed => acknowledged
2013-12-24 12:24 Avishai Note Added: 0072034
2013-12-24 20:56 wp File Added: checklistbox-bidi.png
2013-12-24 20:58 wp Note Added: 0072036
2013-12-24 21:08 Avishai Note Added: 0072037
2013-12-24 21:15 Avishai Note Edited: 0072037 View Revisions
2013-12-24 23:02 Maxim Ganetsky Fixed in Revision => 43587
2013-12-24 23:02 Maxim Ganetsky Note Added: 0072038
2013-12-24 23:02 Maxim Ganetsky Status acknowledged => resolved
2013-12-24 23:02 Maxim Ganetsky Fixed in Version => 1.4
2013-12-24 23:02 Maxim Ganetsky Resolution open => fixed
2013-12-24 23:02 Maxim Ganetsky Assigned To => Maxim Ganetsky
2013-12-25 01:07 Avishai Note Added: 0072039
2013-12-25 01:07 Avishai Status resolved => closed