Ultrabutton and VK_LControl/VK_RControl
Hi,
Just want to know if anyone has run into this problem.
here's a portion of the logic thats driving me up the wall.
function SelectRows(grid,rowidxes) set grid.activerow=nothing 'remove all active rows grid.selected.rows.clear 'clear all selected rows idxes=split(rowidxes,",") if ubound(idxes)>0 then grid.rows.item(cint(rowidxes(0)-1).set_selected(true) 'set the first row to be selected Sys.Desktop.Keydown(Win32api.VK_LCONROL) 'hold down control for each ri in idxes if cint(ri)>grid.rows.count then log.warning "row idx is higher than total rows avaialble" else grid.rows.item(cint(ri)-1).set_selected(true) 'select next row end if next Sys.Desktop.KeyUp(Win32APi.VK_LControl) 'release the Lcontrol key end if end function
my problem is after its supposely has release teh control, clicking the OK button does not do anything.
though if i do it manually holding the lcontrol , select a few iem and then release it, it did nto have aproblem.
So i m kind of stuck on how to 'release' the key so that i can click on teh button directly
Thanks
Hi,
The reason of the problem is that you are mixing two approaches and they do not work together. You are trying to multi-select grid rows by pressing the Control key (end-user action) and then call some grid's internal method (.set_selected() - non end-user action). Most probably, .set_selected() does not do something (set some property, call some method, etc.) that is used by the code that is called on OK button press.
I would recommend to search/check how to click the needed row (it might be something like grid.rows.item(cint(ri)-1).Click) and replace the line with the call to the .set_selected() method with the line(s) that perform a click on the row.
If you fail to find how to click grid's row, then you should examine the list of available grid's methods more carefully - maybe you'll need to call some other method or call two or more methods.
Also, you may search TestComplete's help and samples, as well as this forum for the name/class name of the grid you are working with - there is a chance that you will find a relevant code sample.