Roberto Nicchi Posted October 21, 2021 Share Posted October 21, 2021 Hello, i'm wondering if is possible to set a TUniFormattedNumberEdit object so that it displays the number formatted with 2 decimals (for example) but it allows to insert more decimals (for example 4). Of course if more decimals than two are inserted than all the decimals must be visible. In other words the effect should be that same than the #0.00## display format string. If it's not possible you could add this as a request for future implementation. Myabe adding a new property to indicate the minimum decimals to format. In my example DecimalPrecision=4 and new property FormatPrecision=2 Thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 21, 2021 Share Posted October 21, 2021 1 hour ago, Roberto Nicchi said: i'm wondering if is possible to set a TUniFormattedNumberEdit object so that it displays the number formatted with 2 decimals (for example) but it allows to insert more decimals (for example 4). Of course if more decimals than two are inserted than all the decimals must be visible. In other words the effect should be that same than the #0.00## display format string. If it's not possible you could add this as a request for future implementation. Myabe adding a new property to indicate the minimum decimals to format. In my example DecimalPrecision=4 and new property FormatPrecision=2 Hello, Will this option suit you? procedure TMainForm.UniFormCreate(Sender: TObject); begin with UniFormattedNumberEdit1 do JSInterface.JSCall('updateNumericFormat', [JSControl.JSObject('aPad:false, aSep: "'+ ThousandSeparator +'", aDec: "'+ DecimalSeparator +'", mDec:' + DecimalPrecision.ToString)]); end; Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted October 22, 2021 Author Share Posted October 22, 2021 15 hours ago, Sherzod said: Hello, Will this option suit you? procedure TMainForm.UniFormCreate(Sender: TObject); begin with UniFormattedNumberEdit1 do JSInterface.JSCall('updateNumericFormat', [JSControl.JSObject('aPad:false, aSep: "'+ ThousandSeparator +'", aDec: "'+ DecimalSeparator +'", mDec:' + DecimalPrecision.ToString)]); end; Hello, with this code the value is not formatted at all. It behaves similar to the TuniNumericEdit class. Don't know if is your code not working or i didn't exaplain well enough. I try with an example: If the value is 10 the displayed value must me 10.00 ( i want minimal 2 digits) If the Value is 10.1 the displayed value must me 10.10 If the Value is 10.123 the displayed value must me 10.123 Anyway the user can't insert a value with more than 4 decimals (DecimalPrecision=4) So if the number of decimals are less than 2 i would like to format the value with 2 decimals. If the decimals are more than 2 the value should not be formatted in the decimal part. thanks 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 22, 2021 Share Posted October 22, 2021 Hello, 14 minutes ago, Roberto Nicchi said: Don't know if is your code not working or i didn't exaplain well enough. I understood you perfectly, I just suggested another option. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 22, 2021 Share Posted October 22, 2021 I will try to analyze... Quote Link to comment Share on other sites More sharing options...
Masteritec Posted December 2, 2021 Share Posted December 2, 2021 @Sherzod any update on this? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 2, 2021 Share Posted December 2, 2021 @Masteritec Hello, Sorry for the late reply. I think this is not possible with UniFormattedNumberEdit. Quote Link to comment Share on other sites More sharing options...
Roberto Nicchi Posted December 3, 2021 Author Share Posted December 3, 2021 21 hours ago, Sherzod said: @Masteritec Hello, Sorry for the late reply. I think this is not possible with UniFormattedNumberEdit. Please add this request to the list of unigui future improvements. thanks 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.