Jump to content

UnimDBEdit - Inputtype=number -> decimal point is ignored (both "," and ".")


likemike

Recommended Posts

Hello!

The title says it all. The displayformat of my field in the query is "#####0.00"

Examples:

Input       Output
12,34      1234,00
12.34      1234,00

To make it work, I have to delete the InputType.

Regards

Mike

 

Link to comment
Share on other sites

On 3/3/2021 at 9:27 PM, likemike said:

The title says it all. The displayformat of my field in the query is "#####0.00"

Examples:

Input       Output
12,34      1234,00
12.34      1234,00

To make it work, I have to delete the InputType.

Hello,

Sorry, what's the issue?

Link to comment
Share on other sites

Hello!

OK - I try it with other words.

What I need is a DBEdit field, which is binded to a database TFloatField (it's an amount field and not a currency field!) and which allows me to input values like 1234,56 or 1234.56

I've tried UnimDBEdit with InputType = number.  -> that doesn't work, because I always get integer values (the decimal point is ignored).
I've tried UnimDBNumberEdit -> that doesn't work, because I only get the numbers 0..9 on the touch-keyboard (no decimal point!).

So the problem is, that the UnimDB components are ignoring the "Precision" value of the TFloatField.

BTW: when I set "Currency" to true I get the right result, but with the currency unit.

 

Thanks

Mike

Link to comment
Share on other sites

Hello!

I've found the reason for my problem, but no solution.

The reason is:

In UnimDBEdit (UnimDBNumberEdit) these properties are missing:
    property DecimalUseOSDefault;
    property DecimalPrecision;
    property DecimalSeparator;

while in UniDBEdit (UniDBNumberEdit) they exist.

So it would be nice, if these properties are added in the next release.

Regards

Mike

Link to comment
Share on other sites

  • 1 month later...
On 3/5/2021 at 8:26 PM, Sherzod said:

Sorry, what's the issue?

Проблема в том, что непонятно какой разделитель DecimalSeparator правильно использовать на FrontEnd (в браузере): точку или запятую.

Обратите внимание на картинку 1. На десктопе - запятая, а в мобильной версии - точка. А на картинке 2 тоже мобильная платформа, но уже значение с запятой.

Т.е. нет однозначного правильного значения.

На BackEnd все понятно, там есть FormatSettings и все зависит от настроек операционной системы.

Например, у меня есть TUnimEdit, где inputType = number и мне нужна компонента именно TUnimEdit.

код для мобильной платформы:

UnimEdit1.Text := FloatToStr(DataSet1.Fields[10].AsFloat);// значение "2,99" - работает
или
UnimEdit1.Text := DataSet1.Fields[10].AsString;// значение "2,99" - поле в браузере будет пустым 

 

Но вопрос в том: как правильно и от чего зависит? От браузера, от настроек фреймворка extJS. Если от настроек фреймворка extJS, то где эти настройки посмотреть, изменить?

Этот код для фронтэнда или для бэкэнда:

UniGuiApplication.PfmtSettings.DecimalSeparator :='.';

 

И еще. Чем отличается - uniGUIApplication.FmtSettings от uniGUIApplication.PFmtSettings?

В справке пусто:

http://www.unigui.com/doc/online_help/api/uniGUIApplication_PFmtSettings.html

http://www.unigui.com/doc/online_help/api/uniGUIApplication_FmtSettings.html

 

Screenshot_7.jpg

 

Screenshot_9.jpg

Link to comment
Share on other sites

  • 8 months later...
On 4/19/2021 at 3:08 PM, x11 said:

Проблема в том, что непонятно какой разделитель DecimalSeparator правильно использовать на FrontEnd (в браузере): точку или запятую.

вопрос все еще актуален

Link to comment
Share on other sites

As far as I understand FmtSettings and PFmtSettings is the same things. But second is pointer to FmtSettings:

PFmtSettings: PFormatSettings;

FmtSettings: TFormatSettings;

Found in samples:

procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject);
begin
  with PFmtSettings^ do
  begin
    DateSeparator:='/';
    CurrencyFormat:=0;
    CurrencyString:='$';
  end;
end;

 

Link to comment
Share on other sites

The real problem is, that the component UnimNumberEdit doesn't work as expected.
When you set decimals to 2 the virtual keyboard on the mobil device only shows the numbes 0-9 without decimal point or comma. So it's impossible for the end user to fill in a decimal number like 123,45.

I cannot understand, why it takes so long to fit this bug.

  • Upvote 1
Link to comment
Share on other sites

On 12/20/2021 at 4:33 PM, likemike said:

The real problem is, that the component UnimNumberEdit doesn't work as expected.
When you set decimals to 2 the virtual keyboard on the mobil device only shows the numbes 0-9 without decimal point or comma. So it's impossible for the end user to fill in a decimal number like 123,45.

I cannot understand, why it takes so long to fit this bug.

With which mobile device did you test?

Link to comment
Share on other sites

×
×
  • Create New...