Forum Discussion

venkat001's avatar
venkat001
Occasional Contributor
14 years ago

Error: Window is invisible and thus cannot be activated


I need to change the values of each cell in Table view
window (attached the image file). I'm not able to read each cell or control
properties of Table view window so i decided, first event is click on State 1
cell then use key functions to move up/down across the cells and change the
values of each cell.



Problem: First encountered error: "The window was destroyed during method
execution." so i introduced delay functions to each event now second error
is "The '0 output(s) active' window is invisible and thus cannot be
activated."
Dim
wndAfx


Dim V1,V2,V3,IP1,IP2,IP3


V1=23


V2=32

V3=45


IP1=0


IP2="-120"


IP3=120


I1=1


I2=2


I3=3


VP1=0


VP2="-120"


VP3=0


Dim afxFrameOrView80u


Dim gxedit


Set wndAfx = Aliases.OMSeq.wndAfx.MDIClient.wndAfx1


Call wndAfx.Click(138, 9)


Set afxFrameOrView80u = wndAfx.AfxFrameOrView80u


Set gxedit = afxFrameOrView80u.GXEDIT1


Call afxFrameOrView80u.Click(90, 38)


'Call afxFrameOrView80u.Keys("[F2]")


aqutils.Delay 50


Call gxedit.Keys("[Home]![End]")


aqutils.Delay 50


call gxedit.keys("[Del]")


aqutils.Delay 50


call gxedit.Keys(V1)


aqutils.Delay 50


Call gxedit.Keys("[Down]")



aqutils.Delay
50





Call
afxFrameOrView80u.Keys("[F2]")


Call gxedit.Keys("![End]")


aqutils.Delay 50


call gxedit.keys("[Del]")


aqutils.Delay 50


call gxedit.Keys(V2)


aqutils.Delay 50


Call gxedit.Keys("[Down]")


End
sub








Regards,




Venkateswaran K

2 Replies


  • Hi Venkateswaran,


     


    What is the problematic line where you get the error? Besides that, 50 ms is quite a short delay. Set it to 500.


     


  • They way you are trying to perform action on cells is impossible, You must get a particular cells's object refrence to perform a Keys function, You are performing all action on  afxFrameOrView80u.GXEDIT1 that is the first cell/component.



    Set gxedit = afxFrameOrView80u.GXEDIT1



    Variable gxedit has a reference of GXEDIT1 and that never updates, so all your action are performing on first component, Keys move up/down will transfer the control to next cell but still gxedit has reference of first component and you are trying to edit the value of above cell. May be that's the issue, Keys "F2" enabling second cell for editing but code is trying to writing in first cell.