Recent

Author Topic: Inconsistent borders around Edit Boxes  (Read 5793 times)

vmishka

  • Newbie
  • Posts: 5
Inconsistent borders around Edit Boxes
« on: January 26, 2022, 07:34:36 pm »
Hello,

I am trying to move to Lazarus from Delphi. I wrote a simple app with three TEdits, a TComboBox, and a TListBox. The borders for all of these controls are set to bsSingle. The Combo Box and List Box always display a thin border, as expected. However, the Edit boxes are inconsistent, often with just a lower border, sometimes with a complete border after you click into a different control. There is a blue line at the bottom when the control has focus, but no real border (is there a way to not have the blue line, the flashing cursor should be enough indication?).

Can someone explain this behavior of inconsistent borders to me and is there a way to "correct" it. I am running Windows 11 64-bit, Lazarus 2.2.0, and my monitors are 2560 x 1440 with 125% scaling. In the project options "Use LCL scaling (Hi-DPI)" is checked and DPI awareness is set to "On." I tried scaling my monitor at 100% and that didn't correct the problem. A screenshot is attached (but I don't see it in when I preview).

Thank you for any help.
« Last Edit: January 26, 2022, 07:56:09 pm by vmishka »

SassyPenguin

  • New Member
  • *
  • Posts: 49
Re: Inconsistent borders around Edit Boxes
« Reply #1 on: January 27, 2022, 04:35:18 am »
Noticed also this TEdit border issue, and password char (not being rounded dot) on Windows 11.

I think it may be widget related, as Lazarus is cross platform, it doesn't depend on the native OS control like Delphi does. Lets wait for the updates...
Lazarus 2.2.4 (Win11, Manjaro KDE, CachyOS KDE, Linux Mint)

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Inconsistent borders around Edit Boxes
« Reply #2 on: January 27, 2022, 10:46:54 am »
Dont't blame Lazarus for this. It is the latest style idea by Microsoft. Lots of confusion now: https://sjmulder.nl/2021/textboxes/

Not sure about the occasionally partially drawn upper border line, though; I've never seen this before except for Lazarus applications.

vmishka

  • Newbie
  • Posts: 5
Re: Inconsistent borders around Edit Boxes
« Reply #3 on: January 27, 2022, 07:11:09 pm »
jamestien and wp, thank you for those observations.

wp, thank you for that link, it explains a lot.

It would be nice to know why I am getting partially drawn borders including parts of a side (including in the IDE itself before the app is compiled).
« Last Edit: January 27, 2022, 08:23:25 pm by vmishka »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Inconsistent borders around Edit Boxes
« Reply #4 on: January 27, 2022, 07:37:00 pm »
I think it may be widget related, as Lazarus is cross platform, it doesn't depend on the native OS control like Delphi does. Lets wait for the updates...
Actually Lazarus does depend on native OS / widgetset controls. LCL is a binding library, as opposed to a custom drawn library.
WxWidgets has the same strategy, many other GUI libs are custom drawn.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Inconsistent borders around Edit Boxes
« Reply #5 on: January 27, 2022, 07:54:10 pm »
It would be nice to know why I am getting partially drawn borders including parts of a side (including in the IDE itself before the app is compiled).
The first thing to observe would be if this is really an issue of the applications created by Lazarus only, or does it occur also in other applications. If in Lazarus only, does it occur only at designtime (where I see it quite often) or also at runtime? This would help to decide whether this is a bug in Windows (Win 11 is still very young), in the LCL or in the Lazarus design mode.

Spopovich

  • Newbie
  • Posts: 4
Re: Inconsistent borders around Edit Boxes
« Reply #6 on: January 27, 2022, 08:53:31 pm »
Try to reproduce it on Delphi.
I read that Delphi has updated their APIs to modernize the VCL.
Some of these options are required WinXP.
Other controls like TCombobox or TMemo they remove some XP/98/95 dependencies.

I do not using Win11, so, please, post here the results.

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Inconsistent borders around Edit Boxes
« Reply #7 on: January 27, 2022, 11:09:09 pm »
Found a way to reproduce the issue and filed a bug report: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39613

vmishka

  • Newbie
  • Posts: 5
Re: Inconsistent borders around Edit Boxes
« Reply #8 on: January 28, 2022, 10:57:44 pm »
Thank you, wp, for filing a bug report.

Spopovich, when I get a chance, I will reproduce the simple application in Delphi and test the Lazarus and Delphi applications on both Windows 10 and Windows 11 for comparison.

vmishka

  • Newbie
  • Posts: 5
Re: Inconsistent borders around Edit Boxes
« Reply #9 on: January 30, 2022, 04:17:32 am »
I built the small app in Delphi Community Edition 10.4.2 (using Windows 11) and, of course, ran it in Windows 11 (same conditions as the Lazarus app).

Attached is a screenshot.

As pointed out by wp in his bug report, in the Lazarus application, when you scroll through the controls using the Tab key, the Edit Box borders are constantly changing as I observed in my original post.

This does NOT happen in the Delphi app. The border is the new style with a gray line as bottom border which changes to a blue line when the Edit Box has focus (personally, I am not a huge fan of this style), but that style of border stays consistent when tabbing through the controls.

My wife has the only Windows 10 computer at home and she is rather busy using it at the moment. I will look at the behavior under Windows 10 when I get a chance.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Inconsistent borders around Edit Boxes
« Reply #10 on: January 30, 2022, 03:55:21 pm »
has anyone tried to uncheck the border property in the control?

also have they tried running without themes ?

the LCL actually draws the border if I remember correctly, that could most likely be tailored to behave differently under OS versions etc.
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Inconsistent borders around Edit Boxes
« Reply #11 on: January 30, 2022, 04:14:08 pm »
has anyone tried to uncheck the border property in the control?
The issue is no longer present, but also no border. And the control shrinks in size, probably due to the missing border.

also have they tried running without themes ?
No solution - back to Win95 times...

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Inconsistent borders around Edit Boxes
« Reply #12 on: January 30, 2022, 05:34:04 pm »
I believe this can be fixed if you look at the code in the widget for the theme's drawing of the box.

I haven't yet looked but the psychic that i am  :D, I think the Themes drawing should first call the default window procedure to allow the OS to draw its borders or whatever and then have the LCL code draw its themes box. its just an idea really  :-[
 
The only true wisdom is knowing you know nothing

vmishka

  • Newbie
  • Posts: 5
Re: Inconsistent borders around Edit Boxes
« Reply #13 on: February 02, 2022, 10:49:24 pm »
To follow through on what I promised, I tested the Lazarus build and the Delphi build on Windows 10. Both programs looked and behaved the same on Windows 10. The edit boxes had borders on all four sides, as expected in the Windows 10 style, and the borders of the edit boxes in the Lazarus build did not change when you scrolled through the controls. The anomalous behavior appears to me to only occur in Windows 11. Attached is a screenshot of the Lazarus build.

 

TinyPortal © 2005-2018