FMXGrid ComboEdit not perform an immediate post

Hello:


I'm working with Delphi XE8, Firemonkey and TTMSFMXGrid. I have a column with a ComboEdit.

When the user click a cell, select a value from the combo and the combo closes, the value is not immediately updated until you move to another column o control.

I need to perform some actions just after the combo closes with the new selected value. Is there any way to perform an immediate post of the combo value when it closes?

Thank you...

You can do this in following way:


 TForm1 = class(TForm)
  private
    // ......
    { Private declarations }
    procedure ComboClose(Sender: TObject);
  end;


procedure TForm1.ComboClose(Sender: TObject);
begin
  TMSFMXGrid1.StopEdit;
end;

procedure TForm1.TMSFMXGrid1GetCellEditorProperties(Sender: TObject; ACol,
  ARow: Integer; CellEditor: TFmxObject);
begin
  // for cell that use TComboEdit inplace editor, assign an event handler
  (CellEditor as TComboEdit).OnClosePopup := ComboClose;
end;

Can you give me the "Uses" where is located the TComboEdit?


Thanks...

Hi:


It doesn't work. This code is the same as putting StopEdit in the grid CellComboCloseUp event.

This ends the editing but the grid value is not updated. After closing the ComboBox the grid value remains the same as before the selection.

Any other suggestion?


I cannot see such problem. From where exactly do you read/check the cell value?

Hello:


I create a new sample project (Delphi, Multi Device App). 
I put a FMXGrid on it, and changed the Editor property to ComboBox in Columns 1 and 3. 
I also placed 2 labels called Label1 and Label3 (to be in order with the columns chosen for the example) at the bottom of the columns.
I fill the combos values in the Form.OnCreate event.

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  TMSFMXGrid1.Columns[1].ComboItems.Clear;
  for i := 0 to 9 do
    TMSFMXGrid1.Columns[1].ComboItems.Add(IntToStr(i));

  TMSFMXGrid1.Columns[3].ComboItems.Clear;
  for i := 0 to 9 do
    TMSFMXGrid1.Columns[3].ComboItems.Add(IntToStr(i));
end;

Then I put some code in the ComboCloseUpeven for column 1 and CellEditDone for column 3.

procedure TForm1.TMSFMXGrid1CellComboCloseUp(Sender: TObject; ACol, ARow,
  ItemIndex: Integer; AValue: string);
begin
  if (ACol = 1) and (ARow = 1) then
    Label1.Text := TMSFMXGrid1.Cells[ACol, ARow];
end;

procedure TForm1.TMSFMXGrid1CellEditDone(Sender: TObject; ACol, ARow: Integer;
  CellEditor: TFmxObject);
begin
  if (ACol = 3) and (ARow = 1) then
    Label3.Text := TMSFMXGrid1.Cells[ACol, ARow];
end;

The right value is never shown in neither case.

You can see a video of this application running in the following video:
https://www.youtube.com/watch?v=KC48jeJH6Fo
 
I'm sure I'm doing something wrong but I don't know what.

Thank you.

Hi, 


The behavior you are noticing is that the cells property doesn't yet contain the correct value in the CellComboCloseUp. The cells property is updated afterwards. We have also seen that in XE8 the itemindex in the OnCloseUp event is -1 for the first selection. We can only confirm this as a bug in XE8 as this didn't happen in earlier versions. We will investigate here if we can find a workaround for this issue. 

We are unable to reproduce the issue with the OnCellEditDone event though. This is triggered correctly with the correct value. The TMSFMXGrid1.Cells[ACol, ARow] contains the correct value.

Kind Regards, 
Pieter





Hello:


The OnCellEditDone works fine BUT ONLY after you change the focus. If you don't move to another cell, the event doe not triggers. 

It means: if you select any value from the combobox you can't do anythig with this value until the event triggers. This event is not triggered after the closeup event. That's why I said that I need "an immediate" post of the value. 

Is there any way to trigger this event? 
There are technical issues that prevent closing a combobox programmatically while the popup is still active. The next time the combobox is shown the popup is somehow still open and will cause access violations. If we hookup the OnClosePopup event, the value is not known in the combobox, which is an issue in XE8 and also reproducible with a standalone TComboBox. We will investigate here if there is a workaround for this.

Kind Regards, 
Pieter