Home Coding, Scripting, Shaders

[maxscript] How to add event handler for dot.net dataGridView combobox control in maxscript

polycounter lvl 3
Offline / Send Message
hajnis polycounter lvl 3

I am trying to create script in maxscript with usage of dot.net. I have dataGridView form with comboBoxes. Problem is when i try to register event handlers for every combobox.

I tried the approach from official faq here: https://social.msdn.microsoft.com/Forums/windows/en-US/a44622c0-74e1-463b-97b9-27b87513747e/windows-forms-data-controls-and-databinding-faq?forum=winformsdatacontrols#faq17

In my rollout there is dotNetControl lbxLoadedMaterials with following event:

-- lbxLoadedMaterials is dataGridView
on lbxLoadedMaterials EditingControlShowing args do
    local control = args.Control

    if control != undefined then
        dotNet.RemoveEventHandler control "SelectedIndexChanged" ::g_MaterialLibraryDesigner.ComboBoxIndexChanged
        dotNet.addEventHandler control "SelectedIndexChanged" ::g_MaterialLibraryDesigner.ComboBoxIndexChanged
        dotNet.setLifeTimeControl control #dotnet

in ::g_MaterialLibraryDesigner there is my method for checking index:

public function ComboBoxIndexChanged sender args =
    print "test write"
    print args

The problem is, that event is not firing, not even errors appears.

Does anyone know, where the problem lies?

Thanks a lot!

Sign In or Register to comment.