Hello,
In TTMSFMXDatagrid when the datatype is "bit", the cell is automatically styled as a checkbox.
I tried to override this using the following code
procedure TWorkFrm.DataGridGetCellEditorCustomClassType(Sender: TObject; ACol,
ARow: Integer; var CellEditorCustomClassType: TFmxObjectClass);
begin
inherited;
CellEditorCustomClassType:=TEdit;
end;
procedure TWorkFrm.DataGridGetCellEditorType(Sender: TObject; ACol,
ARow: Integer; var CellEditorType: TTMSFMXGridEditorType);
begin
inherited;
CellEditorType := etCustom;
end;
But none of those events are triggered.How can I display True or False instead of a Checkbox?
Best regards
A checkbox is an always visible cell type, not a cell editor.
Thanks.
I can change the cellClass using the following code
if CellClassType=TTMSFMXCheckGridCell then
begin
CellClassType:=TTMSFMXGridCell;
end;
but the cell is now empty. When setting a breakpoint after "CellClassType:=TTMSFMXGridCell;"
datagrid.cells[Acol,Arow] contains 'TRUE' but at display the cell is empty. How can I display the actual value?
I can't see an issue with displaying text in cells of class TTMSFMXGridCell.
Yes, I use OnGetCellData to return the textbut Cellstring is empty. Therefore, when the OnNeedFilterDataDropdown is fired, TRUE and FALSE are present in the cells and are displayed in the dropdown list.
With XE3 and previous version of TMS pack, I used to replace TRUE or FALSE in user's language by this code
procedure TWorkFrm.DataGridGetCellData(Sender: TObject; ACol, ARow: Integer;
var CellString: string);
begin
inherited;
if (CellString='False') or (Cellstring='True') then
cellstring:=UserSession.GUITranslation[CellString] ;
end;
Now cellstring is empty and boolean Text is Uppercase. I solved my problem this way:
procedure TWorkFrm.DataGridGetCellData(Sender: TObject; ACol, ARow: Integer;
var CellString: string);
begin
inherited;
// if (CellString='False') or (Cellstring='True') then
if (CompareText(Datagrid.Cells[ACol,ARow],'TRUE')=0) then
cellstring:=UserSession.GUITranslation['True']
else if (CompareText(Datagrid.Cells[ACol,ARow],'FALSE')=0) then
cellstring:=UserSession.GUITranslation['False'] ;
end;
Thanks for your help