commas in TSpinEdit etc. lazarus / 31-LCL ---------------------------------------------------------------------- MarkMLl · 2022-11-04 09:30 Can somebody confirm please that there's no comma facility in the standard TSpinEdit/TFloatSpinEdit/TFloatSpinEditEx controls. I'm aware of the proposal at https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/34242 that such things be added, but looking at the controls as implemented in 2.2.4 they appear to never have been implemented. MarkMLl ---------------------------------------------------------------------- wp · 2022-11-04 10:03 Quote from: MarkMLl on November 04, 2022, 10:30:59 amCan somebody confirm please that there's no comma facility in the standard TSpinEdit/TFloatSpinEdit/TFloatSpinEditEx controls. What do you understand as "comma facility"? ---------------------------------------------------------------------- MarkMLl · 2022-11-04 10:10 Setting off groups of three digits with commas. The instrument I'm interfacing to has a couple of places where times need to be specified in nSec, and while I'll probably end up with a RadioGroup so that I can actually enter it in mSec etc. I'd prefer to understand the alternatives first. MarkMLl ---------------------------------------------------------------------- Bart · 2022-11-04 12:06 IIRC then TFloatSpinEditEx has an option to show ThousandSeparator? In main at least. Bart ---------------------------------------------------------------------- MarkMLl · 2022-11-04 13:12 Quote from: Bart on November 04, 2022, 01:06:40 pmIIRC then TFloatSpinEditEx has an option to show ThousandSeparator? In main at least. Not in 2.2.4 unfortunately, and I'm wary about compatibility since I'll be sticking this on GitHub. Hence I'd also prefer no fancy dependencies, since while I thinks it would be realistic to expect a non-Pascal user to install Lazarus+FPC the same doesn't really apply to arbitrary packages. In practice I think I can do something fairly elegant with a FloatSpinEdit and a RadioGroup, with the number of decimal places indicating the current layout any time a button is clicked (so I can, e.g., rescale from nSec to mSec). MarkMLl ---------------------------------------------------------------------- wp · 2022-11-04 14:31 Quote from: Bart on November 04, 2022, 01:06:40 pmIIRC then TFloatSpinEditEx has an option to show ThousandSeparator? In main at least. Really? I don't see it, neither in v2.2.4, or in main. There IS a property "DecimalSeparator", but also a "ThousandSeparator"? What's the name of that property? I consider it to be quite challinging when both decimal and thousand separators are allowed in the control for input, since TFloatSpinEditEx accepts both comma and point as decimalseparator (a feature which I would not be willing to miss). When the input is "1,123" would this mean "1-point-123" or "1 thousand 123"? MarkMLI, I don't exactly understand the problem that you have when entering nanoseconds. But maybe the TFloatSISpinEditEx in the ExCtrls package on CCR may be an alternative: here you simply can type "1.234n" for 1.234E-9 seconds. (https://wiki.freepascal.org/ExCtrls#TFloatSISpinEditEx). ---------------------------------------------------------------------- Bart · 2022-11-04 21:49 Quote from: MarkMLl on November 04, 2022, 02:12:02 pmQuote from: Bart on November 04, 2022, 01:06:40 pmIIRC then TFloatSpinEditEx has an option to show ThousandSeparator? In main at least. Not in 2.2.4 unfortunately, and I'm wary about compatibility since I'll be sticking this on GitHub. ThousandSeparator is a property of TSpinEditEx (not of the float variant), sorry for the confusion. If you set it to anything other than an empty string, the value is used as ThousandSeparator in the ValueToText() function. It's not in current stable because it was implemented after 2.2.0 was released and it is not a bugfix, so it's not merged to 2.2 fixes. Quote from: MarkMLl on November 04, 2022, 02:12:02 pmHence I'd also prefer no fancy dependencies, since while I thinks it would be realistic to expect a non-Pascal user to install Lazarus+FPC the same doesn't really apply to arbitrary packages. Well, simply copying spinex.pp and spinex.inc would probably work OK. Bart ---------------------------------------------------------------------- Bart · 2022-11-04 21:54 Quote from: wp on November 04, 2022, 03:31:03 pmI consider it to be quite challinging when both decimal and thousand separators are allowed in the control for input, Yes, that's why I only implemented this for TSpinEditEx (it was a feature request IIRC). It may be possible for TFloatSpinEditEx as well though. As long as ThousandSeparator <> DecimalSeparator. In essence, you insert ThousandSeparator in ValueToText() and remove it in TextToValue(). And you should not insert it if displayMode <> dmFixed (and maybe in dmAuto it can be applied as well). Most likely not worth the hassle though. Bart