Forum Discussion
jmcwhinney
10 years agoContributor
Here is another example:
I have created a function that takes a reference to my table, and then sets a filter in the tables header:
SetColumnFilterByLabel(XGrid, ColumnLabel, NewFilterValue);
This way I can ensure I am always updating the right filter, even if the order of the table columns changes.
(So my script will be more reliable).
My function identifies the target field it wants to update (MyField), and then sets the filter value successfully using .setText().
This works, however, .setText() doesn't trigger the table to refresh etc. I need to send the TAB or Enter key to exit the field properly so the application refreshes the table.
I cannot use the .Keys("[Tab]"); function because TestComplete did not give me the reference to this specific field, I obtained the field reference programmatically.
As a workaround, I have tried to trigger the JTextField's update event using the below code:
MyField.dispatchEvent(new KeyEvent(XGrid.getTopLevelAncestor(),KeyEvent.KEY_TYPED, 0, 0, KeyEvent.VK_UNDEFINED, 'H'));
I have created a function that takes a reference to my table, and then sets a filter in the tables header:
SetColumnFilterByLabel(XGrid, ColumnLabel, NewFilterValue);
This way I can ensure I am always updating the right filter, even if the order of the table columns changes.
(So my script will be more reliable).
My function identifies the target field it wants to update (MyField), and then sets the filter value successfully using .setText().
This works, however, .setText() doesn't trigger the table to refresh etc. I need to send the TAB or Enter key to exit the field properly so the application refreshes the table.
I cannot use the .Keys("[Tab]"); function because TestComplete did not give me the reference to this specific field, I obtained the field reference programmatically.
As a workaround, I have tried to trigger the JTextField's update event using the below code:
MyField.dispatchEvent(new KeyEvent(XGrid.getTopLevelAncestor(),KeyEvent.KEY_TYPED, 0, 0, KeyEvent.VK_UNDEFINED, 'H'));
However I receive the following error message:
"Microsoft JScript runtime error. 'KeyEvent' is undefined"
Related Content
- 11 years agoRyan_Moran
- 11 months agosanjayram
Recent Discussions
- 2 hours agotramuntana
- 2 days agoSlickRick