Forum Discussion

ArjenMeijeringh's avatar
ArjenMeijeringh
New Contributor
9 years ago
Solved

In TestComplete, a value in an editfield in a grid is not updated when playing the appropriate test

When I record a test and change the value in an editfield in a grid, the value is updated.

But when I play that same test, the value in the edit-box is not updated. I tried to get it updated by using a TAB and an ENTER from the corresponding field and also by clicking outside the grid after entering a value in the corresponding field, but in all cases the value is not changed when playing the test.

 

The relevant scriptcode, generated from recording the test, is shown below. 

The sleep statements were added to try to get the field updated before the next value is written in the editfield, but that also didn't work.

 

Hope you can give me some clues why the editfield is not updated as expected. I'm working with TestComplete, version 12.20.935.7

 

tcxGrid := tdxDockPanel.ConceptPricesGrid;
for i := 0 to 100 do
begin
  tcxGrid.DblClickCell(0, 13, 1);
  tcxCustomInnerTextEdit := tcxGrid.TcxGridSite.TcxCurrencyEdit.TcxCustomInnerTextEdit;
  tcxCustomInnerTextEdit.SetText(IntToStr(i+2)+'.50');
  sleep(2000);
  tcxCustomInnerTextEdit.Keys('[Tab]');
  sleep(2000)
end;

3 Replies

  • baxatob's avatar
    baxatob
    Community Hero

    Try to change this string:

     

    tcxCustomInnerTextEdit.SetText(IntToStr(i+2)+'.50');

    To:

     

    tcxCustomInnerTextEdit.Keys(IntToStr(i+2)+'.50');
    • karthick7's avatar
      karthick7
      Contributor

      to be Improve that code

       

      Please Include

       

      //clear content if exists

      EditObject.Keys("[Home]![End][Del]");

       

      then

      EditObject.Keys(" Your Input");

       

      Regards,

      Karthick

      • ArjenMeijeringh's avatar
        ArjenMeijeringh
        New Contributor

        Nice, that works!

        Thanks for your help :smileyhappy: