Delphi TMS 网格移动到用户后的下一列 Select 下拉列表中的值

Delphi TMS Grids Moving to Next Column After User Select Value in Dropdown

我有一个具有 TAdvStringGrid 的 Delphi 2006 应用程序。网格中有一列,我必须在其中显示一个下拉框。它工作正常,但我无法将光标移动到网格中的下一列。我要移动到的列已被选中,但焦点仍在下拉列表中。 这是它应该如何工作的。用户将输入一个数字,我将显示与用户键入的索引关联的项目。如果用户键入项目名称,我将在下拉列表中查找该项目。在这两种情况下,如果用户输入了正确的值,我想移动到网格中的下一列。如果输入的值没有退出,我会告诉用户它是无效的。

   E := 0;
    if (tcxDisplayOption.Visible = True) then
    begin
      if (OutPutList.Count > 1) then
       begin
        TryStrToInt(tcxDisplayOption.Text, E) ;
        if (E > 0 ) and ( E <= tcxDisplayOption.Properties.Items.Count - 1)   then
        BEGIN
         tcxDisplayOption.ItemIndex := tcxDisplayOption.Properties.Items.IndexOf(tcxDisplayOption.Properties.Items[E]);
         TestGrid.SetFocus;
         TestGrid.EditMode := true;
         TestGrid.SelectedCells[2,currentRow];
         TestGrid.EditCell(2,currentRow);
        END
        else if (E = 0) and (Length(tcxDisplayOption.Text) > 1) then
         begin
         index := tcxDisplayOption.Properties.Items.IndexOf(tcxDisplayOption.Text);
         if not (index = -1) then
         begin
         TestGrid.SetFocus;
         TestGrid.EditMode := true;
         TestGrid.SelectedCells[2,currentRow];
         TestGrid.EditCell(2,currentRow);
         end
         else
         begin
          ShowMessage('Not a vaild option.');
         end;
         end
         else
         begin
           ShowMessage('Not a valid option.');
         end;
       end;
    end;

我必须添加 2 个事件才能使其正常工作。我添加了一个 onHasCombobox 事件和一个 OnGetEditorProp 事件。对于 onHasCombobox 事件中的第 5 列,我总是 return true,这是我需要组合框的地方。然后,当单击下拉列表时,它会调用 OnGetEditorProp,然后显示我需要在下拉列表中显示的数据。