IMPORTANT NOTICE: As of 21 February, anything posted in this community WILL NOT BE MIGRATED to our new community site. We have pulled all user information and data from this site and are now in an approximately week long process of importing users, roles, and data to our new site. We are leaving this site open and active so you can post and hopefully get a response until the migration is complete. Once complete, the URL that currently takes you to this site will take you to our new site so your bookmarks will work as always. Please read the information on a New Login Process
On occasion the SilkTest method DoubleClick() sometimes does not work. This usually happens when the application opens a dialog on the first click and carries out another function with the second click. The SilkTest doubleclick() method can be too fast.
The following function substitutes for the SilkTest Click() and DoubleClick() methods, allowing you to specify the window to work in, the mouse button (left, right, middle) and the click type (single, double). The function prototype needs to be placed below the tag in the parent window of the object to be worked on.
NewClick(window wWindow,integer iButton,integer iClickType,integer iXpos,integer iYpos)
iXpos and iYpos can be found by Recording Testcase and noting the co-ordinates of the non-functioning Click() or DoubleClick() command.
The following must be placed at the head of the frame file:
[-] dll "user32.dll"
[ ] mouse_event (long dwFlags ,long dx,long dy,long cButtons,long dwExtraInfo)
[-] void NewClick(window wWindow, integer iButton,integer iClickType, integer x, integer y)
[ ] integer i=0
[ ] // various Constants to manipulate different buttons on mouse
[ ] const MOUSEEVENTF_LEFTDOWN = 2
[ ] const MOUSEEVENTF_ABSOLUTE = 32768
[ ] const MOUSEEVENTF_LEFTUP = 4
[ ] const MOUSEEVENTF_MIDDLEDOWN = 14
[ ] const MOUSEEVENTF_MIDDLEUP = 64
[ ] const MOUSEEVENTF_MOVE = 1
[ ] const MOUSEEVENTF_RIGHTDOWN = 8
[ ] const MOUSEEVENTF_RIGHTUP = 16
[ ] //Set the click type default
[ ] iClickType=1
[ ] //Set the button default
[-] if(iButton>3 || iButton==0)
[ ] iButton=1
[ ] // Move Mouse Pointer over current mouse object
[ ] //this.MoveMouse(x,y)
[ ] wWindow.MoveMouse(x,y)
[ ] //Send message to mouse controller to press and release mouse at the specified position
[ ] //Left mouse button
[ ] mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
[ ] mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
[ ] //Right mouse button
[ ] mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
[ ] mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
[ ] //Middle mouse button
[ ] mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0)
[ ] mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0)
[ ] return
Insert the prototype under the parent window tag e.g.
[ ] // tag "Chart Navigator"
[ ] // NewClick(window wWindow,int iButton,int iClickType,int x,int y)
[ ] // NewClick(Navigator.NavTree.ShipList.CurrentChart,1,2,136,77)