View Issue Details

IDProjectCategoryView StatusLast Update
0006544JEDI VCL00 JVCL Componentspublic2019-04-13 15:39
ReporterakalwaAssigned ToAHUser 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in VersionDaily / GIT 
Summary0006544: TJvCustomComboEdit (and descendants) ignore the user's caret width setting
DescriptionWindows allows users to change the caret width (text cursor width) to more than the default 1 pixel. While all contols derived from TCustomEdit work as expected, TJvCustomComboEdit and descendants ignore the user's setting.

The bug is in TJvCustomComboEdit.SetShowCaret().
Here the caret size is set as either 1 or 2 pixel, depending on the font's bold style. But that is not Windows' behaviour. Caret is usually not changed on font style. Instead the caret width should be read from the system settings:

procedure TJvCustomComboEdit.SetShowCaret;
var
  CaretWidth : Integer;
begin
  if not SystemParametersInfo(SPI_GETCARETWIDTH, 0, @CaretWidth, 0) then
  begin
    CaretWidth := 1;
    if fsBold in Font.Style then
      Inc(CaretWidth);
  end;
  CreateCaret(Handle, 0, CaretWidth, GetTextHeight);
  ShowCaret(Handle);
end;
Additional InformationControl Panel -> Ease of Access Center -> Make the computer easier to see ->
Set the thickness of the blinking cursor
Change the default width from 1 to 3 pixel and apply the changes.

https://techjourney.net/increase-the-thickness-of-blinking-cursor-in-windows/
TagsNo tags attached.

Activities

obones

2018-07-18 15:52

administrator   ~0021520

Could you check if the issue is still present in the latest GIT content? If yes, please provide the zipped sources of an application showing this.

2018-07-18 22:18

 

CaretWidth.zip (1,491 bytes)

akalwa

2018-07-18 22:22

reporter   ~0021559

The bug is still there in current git revision. The code in JvToolEdit.pas TJvCustomComboEdit.SetShowCaret() has not been changed.

I've attached a small demo application.
Compile and run the application; open Windows caret settings and change caret with to 4 or higher.
Switch back to the demo application and put focus to the TEdit box; the new caret width will be used. Put focus to the TJvComboEdit box; caret width is still 1.

Please apply attached patch to fix this bug (Sorry, no pull request; still using TortoiseSVN to access the master repository).

2018-07-18 22:22

 

JvToolEdit.pas.patch (668 bytes)
Index: JvToolEdit.pas
===================================================================
--- JvToolEdit.pas	(revision 24539)
+++ JvToolEdit.pas	(working copy)
@@ -3124,10 +3124,16 @@
 end;
 
 procedure TJvCustomComboEdit.SetShowCaret;
-const
-  CaretWidth: array [Boolean] of Integer = (1, 2);
+var
+  CaretWidth : Integer;
 begin
-  CreateCaret(Handle, 0, CaretWidth[fsBold in Font.Style], GetTextHeight);
+  if not SystemParametersInfo(SPI_GETCARETWIDTH, 0, @CaretWidth, 0) then
+  begin
+    CaretWidth := 1;
+    if fsBold in Font.Style then
+      Inc(CaretWidth);
+  end;
+  CreateCaret(Handle, 0, CaretWidth, GetTextHeight);
   ShowCaret(Handle);
 end;
 
JvToolEdit.pas.patch (668 bytes)

akalwa

2018-07-18 22:23

reporter   ~0021560

On Windows 10, just type "Caret" into the start menu to open the settings.

akalwa

2018-12-18 18:59

reporter   ~0021600

Any news on this?
Please someone grab the attached patch from 2018-07-18 and apply it the current source code. TIA

AHUser

2019-04-13 15:39

developer   ~0021679

Fixed in master branch.

Issue History

Date Modified Username Field Change
2017-01-26 15:42 akalwa New Issue
2018-07-18 15:52 obones Note Added: 0021520
2018-07-18 15:52 obones Status new => feedback
2018-07-18 22:18 akalwa File Added: CaretWidth.zip
2018-07-18 22:22 akalwa Note Added: 0021559
2018-07-18 22:22 akalwa File Added: JvToolEdit.pas.patch
2018-07-18 22:23 akalwa Note Added: 0021560
2018-12-18 18:59 akalwa Note Added: 0021600
2019-04-13 15:39 AHUser Note Added: 0021679
2019-04-13 15:39 AHUser Status feedback => resolved
2019-04-13 15:39 AHUser Fixed in Version => Daily / GIT
2019-04-13 15:39 AHUser Resolution open => fixed
2019-04-13 15:39 AHUser Assigned To => AHUser