Jump to content

DbGrid Column TUniNumberEdit Editor FAILS TO PAINT CORRECTLY


andyhill

Recommended Posts

I have a DBGrid with a TUniNumberEdit Editor for Floating Numbers set to 2 Decimal places that fails to paint only 2 decimal places, please advise - thanks.

    // GST
    nmInvEdit2.Alignment:= taRightJustify;
    nmInvEdit2.AllowBlank:= False;
    nmInvEdit2.DecimalSeparator:= '.';
    nmInvEdit2.DecimalPrecision:= 2;
      // GST
      Columns.Add;
      Columns.Items[i].FieldName:= 'GST';
      Columns.Items[i].Visible:= True;
      Columns.Items[i].Title.Alignment:= taRightJustify;
      Columns.Items[i].Title.Caption:= '$GST';
      Columns.Items[i].Width:= 100;
      Columns.Items[i].Editor:= nmInvEdit2;
      //Columns.Items[i].Flex:= 1;
      Columns.Items[i].Font.Color:= clBlack;
      Columns.Items[i].Sortable:= True;
      Columns.Items[i].ShowSummary:= False;

 

GridEditorNumber.jpg

Link to comment
Share on other sites

When the grid is first loaded from the data-source more than 2 decimal places are shown.

If I edit then after post the 2 decimal place rule is adhered to.

How do I make the grid on first load paint the 2 decimal place rule ?

Link to comment
Share on other sites

On 8/6/2020 at 12:40 AM, andyhill said:

I have a DBGrid with a TUniNumberEdit Editor for Floating Numbers set to 2 Decimal places that fails to paint only 2 decimal places, please advise - thanks. 


    // GST
    nmInvEdit2.Alignment:= taRightJustify;
    nmInvEdit2.AllowBlank:= False;
    nmInvEdit2.DecimalSeparator:= '.';
    nmInvEdit2.DecimalPrecision:= 2;

      // GST
      Columns.Add;
      Columns.Items[i].FieldName:= 'GST';
      Columns.Items[i].Visible:= True;
      Columns.Items[i].Title.Alignment:= taRightJustify;
      Columns.Items[i].Title.Caption:= '$GST';
      Columns.Items[i].Width:= 100;
      Columns.Items[i].Editor:= nmInvEdit2;
      //Columns.Items[i].Flex:= 1;
      Columns.Items[i].Font.Color:= clBlack;
      Columns.Items[i].Sortable:= True;
      Columns.Items[i].ShowSummary:= False;

 

GridEditorNumber.jpg

Hi,

I can't reproduce the issue. Can you please attach a test case?

 

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...