TDBAdvGrid FloatSpinEditor increment

Hi All,

I am sure I am missing something obvious here, but could someone point out where I am going wrong....

I have a TDBAdvGrid in which one column being displayed is a float with 2 decimal places. FloatFormat set as %1.2f  ie 1.34
I am allowing the user to edit the column data with the editor set as edFloatSpinEdit.

I need the increment to be 0.01, but it is incrementing in 0.1 increments.
SpinStep is set to 1 as its an int value.

Where do I tell the grid I need a precision of 2 for that columns increments?

Cheers



Good afternoon Jim,

i'm not use AdvSpinEdit into grid, but if it's the same advspinedit i'm use to increment 0,01 you have to set the IncrementFloat property to 0,01.

Also, in AdvSpinEdit there's a Precision property, set it to 2.



Regard



Daniele

Hi Daniele,
Thanks for the reply.

However I am using the native editor in the grid from the TDBGridColumnItem, there is no properties for IncrementFloat or Precision. SpinStep is the only property I see that looks probable, and it is an integer.

Hi Jim,

i don't use DBAdvGrid (becuse i prefer tu use AdvStringGrid) but both components have the GetEditorType event.

With this event you can set an editor type depending from the column and/or row.

I try with AdvStringGrid (i have no db to test DB version) and the following code (as the documentation).

In this grid if you click on column 2 a spin edit apperars.



procedure TForm1.SG1GetEditorType(Sender: TObject; ACol, ARow: Integer;

var AEditor: TEditorType);

begin

if Acol = 2 then

Begin

     Aeditor:=edSpinEdit;

     SG1.SpinEdit.EditorEnabled:=True;

     SG1.SpinEdit.Precision:=2;

     SG1.SpinEdit.SpinType:=sptFloat;

     SG1.SpinEdit.IncrementFloat:=0.01;

End;

end;



The funny thing is, even is specified as float type ..... the spin edit respond as interger type (on delphi rio)

If the editor type respond as a spintype, i think this is thw way to follow.



Have a nice day



Daniele

Works like a charm.

Thank you for the help Daniele!