Sign in to follow this  
Followers 0

ActiveX events broken

1 post in this topic

#1 ·  Posted

Hi AutoIt nerds,

who can help me out with this issue? It is driving me nuts.

I found a great activeX control, MSTgrid, that is much easier for me than listview with all the options I need. However there's a strange thing going on. I have bound to the control to receive its events and it does so as expected BUT... the precise moment I enter a key when in the edit mode of a cell all of the events stop firing from then on. And it doesn't start again either when out of the edit mode.

The same control bound to VB or to Excel works as expected and gives events like KeyPressEdit and ChangeEdit and so on. I have no clue as why AutoIt behaves different.

Below a sample script and the free control to download (which has to be installed of course).

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=D:\nlrgo\My Documents\My AutoIt Scripts\SQList2\datagrid.kxf
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_Close")
$Obj1 = ObjCreate("MstGrid.grdView")
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 10, 10, 500, 300)
#EndRegion ### END Koda GUI section ###
$Event = ObjEvent($Obj1, "MSTEvent_")
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")
Func MSTEvent_($ev)
ConsoleWrite("Event: " & $ev & @CRLF)
Func Form1_Close()
Func MyErrFunc()
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"    & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & hex($oMyError.number,8)  & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
             "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile     & @CRLF & _
             "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
While True

It seems that I cannot attache the control but you can download it from everywhere.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0