Recent

Author Topic: Why not...  (Read 2041 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1600
Why not...
« on: April 01, 2024, 04:28:10 am »
add NumberOnly property to TLabeledEdit like TEdit?

Or, is it difficult to make TDBLabeledEdit, or TRTTILabeledEdit?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4570
  • I like bugs.
Re: Why not...
« Reply #1 on: April 01, 2024, 06:43:14 am »
AFAIK TLabeledEdit is there mostly for Delphi VCL compatibility.
It works poorly with the LCL's anchor system. Better use a separate TLabel and anchor it with a desired type of edit control.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Bart

  • Hero Member
  • *****
  • Posts: 5563
    • Bart en Mariska's Webstek
Re: Why not...
« Reply #2 on: April 01, 2024, 12:33:13 pm »
add NumberOnly property to TLabeledEdit like TEdit?

Or, is it difficult to make TDBLabeledEdit, or TRTTILabeledEdit?

Since this component inherits from TCustomEdit, it already has a NumbersOnly property.
I published it in commit 76182b6c and put it up for merging to fixes_3 branch.

Bart
« Last Edit: April 01, 2024, 12:34:46 pm by Bart »

wp

  • Hero Member
  • *****
  • Posts: 12800
Re: Why not...
« Reply #3 on: April 01, 2024, 12:42:12 pm »
However, NumbersOnly is not very useful. You cannot even enter neither a '-' for negative values nor a decimalseparator for floating point numbers. Simply: don't use it. Use a SpinEdit (FloatSpinEdit) or - if you don't like the spinner buttons - TSpinEditEx (TFloatSpinEditEx) with UpdownVisible=false.

Bart

  • Hero Member
  • *****
  • Posts: 5563
    • Bart en Mariska's Webstek
Re: Why not...
« Reply #4 on: April 01, 2024, 12:50:59 pm »
However, NumbersOnly is not very useful.
Yet another thing we needed because Delphi has it (because Windows has it, but implemented it in a dumb-ass manor).
I'm sorry to say I ported it to Lazarus  :-[

Fortunately it is off by default.

wp

  • Hero Member
  • *****
  • Posts: 12800
Re: Why not...
« Reply #5 on: April 01, 2024, 01:58:55 pm »
BTW, do you know if this NumberOnly insanity happens only in Windows or also in other widgesets?

Bart

  • Hero Member
  • *****
  • Posts: 5563
    • Bart en Mariska's Webstek
Re: Why not...
« Reply #6 on: April 01, 2024, 04:38:40 pm »
I would think on other WS it was implemented to behave as Windows does.
I would need to test though.
It's been a long time since this was discussed.

Bart

 

TinyPortal © 2005-2018