Jump to content

DefaultFloatFormat in UniDBGrid


zilav

Recommended Posts

I have FormatSettings.DecimalSeparator = ',' but UniDBGrid insists on displaying float field values using dot '.' to separate decimals. What should I put into UniDBGrid.WebOptions.DefaultFloatFormat to make it use comma? Obvious values like '0,0' doesn't change anything.

Link to comment
Share on other sites

  • 4 years later...
  • 1 month later...
3 hours ago, x11 said:

but i don't know how to do it in uniGUI

The Correct place to put FormatSetting is on ServerModule  Initialization Section :

procedure TUniServerModule.FirstInit;
begin
  InitServerModule(Self);
end;



initialization

// correct place to initialize global FormatSettings parameters

//********************************************
  UniGuiApplication.PFmtSettings.CurrencyString := '€';
  UniGuiApplication.PfmtSettings.CurrencyFormat:=3;  //  See F1 CurrencyFormat 0 =  €1    1 = 1€     2 = € 1     3 =  1 €
  UniGuiApplication.PfmtSettings.DecimalSeparator :='.';
  UniGuiApplication.PfmtSettings.ThousandSeparator:=' ';
  UniGuiApplication.PfmtSettings.DateSeparator := '/';
  UniGuiApplication.PfmtSettings.ShortDateFormat:='dd/MM/yyyy';
  UniGuiApplication.PfmtSettings.TimeSeparator :=':';
  UniGuiApplication.PfmtSettings.LongTimeFormat :='hh:nn:ss';
  UniGuiApplication.PfmtSettings.ShortTimeFormat:='hh:nn:ss';
//********************************************

  // IMPORTANT !!!
  //  AFTER in the code  for all functions  : StrToFloat, FloatToSrt, DateToStr, ...
  //  Must have  FmSetting :
  //  StrToFloat(ch, UniGuiApplication.FmtSettings)    ,  ...
  //  DateToStr(madate, UniGuiApplication.FmtSettings)
  
  //  Example :  v:=StrToFloat(St, UniGuiApplication.FmtSettings);



  RegisterServerModuleClass(TUniServerModule);
end.

 

 

  • Like 1
Link to comment
Share on other sites

Mmm...

Erratum :

The Correct place to put FormatSetting (if the application is aimed at a large audience) is on MainModule  Create Section as have described Farshad.

Effectively, each session will have its own format. So, we can have a Brazilian user, an Arabic user and so...

Thank you Farshad.

Link to comment
Share on other sites

  • 5 weeks later...

I  set the  

PFmtSettings.ThousandSeparator:=' ';

in MainModule for the user

but then activate the format in the undDbGrid by setting the DisplayFormat of the field in the Query linked to the grid. So to activate the thousand seperator here use #,### or #,##0 or similair...

image.png.154bc851092bfdc912721ccc1607e74a.png

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...