Recent

Author Topic: Not happy with TTimeEdit  (Read 3909 times)

skydaddy

  • New member
  • *
  • Posts: 9
Not happy with TTimeEdit
« on: July 16, 2025, 07:19:50 pm »
I don't like the way TTimeEdit works.  Clicking the clock brings up the selection popup.  You pick an hour and minutes value and must double click to select. This feels awkward especially when you must do this double clicking many times a day.  Also the hours in the popup is always displayed in 24hr time which the users of my software do not like. The TTimeEdit documentation did not me help here.

Does anybody know of a better control? I have searched the Lazarus web site but cannot find anything better.

wp

  • Hero Member
  • *****
  • Posts: 13433
Re: Not happy with TTimeEdit
« Reply #1 on: July 16, 2025, 08:04:18 pm »
Add the string 'AM/PM' to the global DefaultFormatSettings's time formats (e.g. 'hh:nn AM/PM' for ShortFormat, and 'hh:nn:ss AM/PM' for LongFormat) - this will switch to the 12-hour format. The drop-down, however, still displays 24 hours. Please file a feature request in the bug tracket, maybe somebody add 12-hour mode here as well.

Alternatively, you can also use the TDateTimePicker where you find settings in the Object Inspector to activate 12 hour mode. It has no hour/minute drop-down, though.

skydaddy

  • New member
  • *
  • Posts: 9
Re: Not happy with TTimeEdit
« Reply #2 on: July 16, 2025, 09:45:34 pm »
Thank you for your reply.  I will do as you suggest.

gues1

  • Guest
Re: Not happy with TTimeEdit
« Reply #3 on: July 16, 2025, 10:12:19 pm »
You can view also TJvTimeEdit from Project Jedi (JVCLLaz OPM), I'm not sure it is present in the package.

I suppose it works only in Windows.

skydaddy

  • New member
  • *
  • Posts: 9
Re: Not happy with TTimeEdit
« Reply #4 on: July 16, 2025, 10:21:39 pm »
Thanks for your reply.  I just installed Jvcllaz (everything) using online package manager but I do not see that component. Can it be located somewhere else?

gues1

  • Guest
Re: Not happy with TTimeEdit
« Reply #5 on: July 16, 2025, 10:29:19 pm »
Thanks for your reply.  I just installed Jvcllaz (everything) using online package manager but I do not see that component. Can it be located somewhere else?
I don't know, I use normaly Delphi and it is present in JVSpin unit.

wp

  • Hero Member
  • *****
  • Posts: 13433
Re: Not happy with TTimeEdit
« Reply #6 on: July 16, 2025, 10:47:04 pm »
The unit JvSpin (containing the TJvTimeEdit) has not yet been ported to Lazarus.

gues1

  • Guest
Re: Not happy with TTimeEdit
« Reply #7 on: July 16, 2025, 10:58:04 pm »
The unit JvSpin (containing the TJvTimeEdit) has not yet been ported to Lazarus.
I install now Lazarus 4.0 and see the packages, one of the demo from JVClLaz (JvTimeFramework) suffer the same issue: they present a flow with AM/PM and use TTimeEdit that use 24h rappresentation instead.

I only tried to see if there are something usefull.
« Last Edit: July 16, 2025, 11:19:43 pm by gues1 »

n7800

  • Hero Member
  • *****
  • Posts: 650
  • Lazarus IDE contributor
    • GitLab profile
Re: Not happy with TTimeEdit
« Reply #8 on: July 18, 2025, 03:09:32 am »
For those interested, here is a link to the issue:

https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41766

wp

  • Hero Member
  • *****
  • Posts: 13433
Re: Not happy with TTimeEdit
« Reply #9 on: July 18, 2025, 08:03:25 pm »
Add the string 'AM/PM' to the global DefaultFormatSettings's time formats [...]
I wrote this before looking at the TTimeEdit component in detail. In fact, manipulation of the DefaultFormatSettings is not necessary, the component is well-prepared to handle 12-hour time formats. Just use the correct format string in the TimeFormat property of the control - I described the options in detail in the wiki article https://wiki.lazarus.freepascal.org/TTimeEdit#Time_format.

The article now also describes how hours and minutes can be selected in the dropdown window most efficiently. I don't understand what you dislike in a double-click. What else would you propose?

As for the hour-minute-selection popup window, I modified the strings in the hours grid such that hours are displayed in 12-hour mode when that is activated in the TTimeEdit. There is a screenshot for it in the bug report: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41766

Please give feedback so that I can backport the changes to Laz 4.2 (which will be released pretty soon).

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4698
  • I like bugs.
Re: Not happy with TTimeEdit
« Reply #10 on: July 19, 2025, 09:31:54 am »
The article now also describes how hours and minutes can be selected in the dropdown window most efficiently. I don't understand what you dislike in a double-click. What else would you propose?
I personally consider double-click a bug in GUI design in general because it requires extra concentration and coordination.
I am able to do it but I know older people who clench their hand instead of just moving a finger when trying to double-click and the hand always moves a little between the clicks. For them a computer is a frustrating experience.
I have KDE here which does not need double-click anywhere. Earlier when I used Windows, I configured the single-click option there as well.

Maybe TTimeEdit could have a "Select" button down on the popup. There is empty space beside the "<<" / ">>" button. Then one could use it purely with mouse without keyboard and without double-click.
« Last Edit: July 19, 2025, 09:34:25 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

wp

  • Hero Member
  • *****
  • Posts: 13433
Re: Not happy with TTimeEdit
« Reply #11 on: July 19, 2025, 09:52:08 am »
OK, this makes sense, I'll add a "Select" button.

[EDIT] Done - and a bit more: When there is a specific button to select I am convinced that there must be also a button to close the popup to keep the old data without selecting anything new. And for having everything in place I decided to used the good-old button panel.

« Last Edit: July 19, 2025, 11:21:59 am by wp »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4698
  • I like bugs.
Re: Not happy with TTimeEdit
« Reply #12 on: July 19, 2025, 01:07:54 pm »
Looks good! The arrow button is also more intuitive now.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018