COM Builder event handling

Discussion in 'MATLAB' started by Matthew Carson, Feb 17, 2004.

  1. Does anyone have any experience with getting COM Builder events to
    work in Matlab 6.5.1? I have set up an event exactly as shown in the
    examples in the docs, and it simply does not fire off the VB event!
    I thought maybe there had to be some arguments passed, so I tried it,
    but it didn't make any difference.

    main m file:

    function add_run_Callback(hObject, eventdata, handles)

    msgbox('Add run main callback');
    add_run(1);

    add_run.m:

    function add_run(i)

    msgbox('Add run event m file');
    %#event

    VB file:
    Public WithEvents shock_wrapper As MWshock.MWshock

    Private Sub Form_Load()
    ...
    Set shock_wrapper = New MWshock.MWshock
    ...
    End Sub

    Private Sub shock_wrapper_add_run(ByVal i As Integer)
    pi_file_form.Visible = True

    End Sub

    It simply never runs the shock_wrapper_add_run function, gives no
    errors or anything! I am at my wits end with this. It does show the
    message box from the callback function - but not the one in
    add_run.m. Which tells me it should be trying to pass control back
    to the event handler. But it doesn't do it! I have checked and
    rechecked my spelling but I can't find anything. Anybody got any
    ideas?

    -Matt
     
    Matthew Carson, Feb 17, 2004
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.