Home Coding, Scripting, Shaders

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

hajnis
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: <a rel="nofollow" href="https://social.msdn.microsoft.com/Forums/windows/en-US/a44622c0-74e1-463b-97b9-27b87513747e/windows-forms-data-controls-and-databinding-faq?forum=winformsdatacontrols#faq17" title="Link: https://social.msdn.microsoft.com/Forums/windows/en-US/a44622c0-74e1-463b-97b9-27b87513747e/windows-forms-data-controls-and-databinding-faq?forum=winformsdatacontrols#faq17">https://social.msdn.microsoft.com/Forums/windows/en-US/a44622c0-74e1-463b-97b9-27b87513747e/windows-forms-data-controls-and-databinding-faq?forum=winformsdatacontrols#faq17</a>

In my rollout there is dotNetControl lbxLoadedMaterials with following event:

  1. -- lbxLoadedMaterials is dataGridView
  2. on lbxLoadedMaterials EditingControlShowing args do
  3. (
  4. local control = args.Control
  5.  
  6. if control != undefined then
  7. (
  8. dotNet.RemoveEventHandler control "SelectedIndexChanged" ::g_MaterialLibraryDesigner.ComboBoxIndexChanged
  9. dotNet.addEventHandler control "SelectedIndexChanged" ::g_MaterialLibraryDesigner.ComboBoxIndexChanged
  10. dotNet.setLifeTimeControl control #dotnet
  11. )
  12. )

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

  1. public function ComboBoxIndexChanged sender args =
  2. (
  3. print "test write"
  4. print args
  5. ),

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.