Home Coding, Scripting, Shaders

Is that possible to add a button to the System.Windows.Forms.ListView with maxscript?

Offline / Send Message
Pinned

I created a dotnetcontrol listview in a rollout, and I want add some click event for each list cells. Like the event on pressed do for button, when press the button, executing some other functions. My listview:

dotNetControl  xx  "System.Windows.Forms.ListView" width:600 height:300

Is that possible to add a control button as the list content or How to add click event for each cell? If add button works it is preferred. Thanks in advance!


Replies

  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Its been a long time since Ive done any dotnet and maxscript but I think you can do it with a datagridview atleast the dotnet documentation shows you can do it. You might have to style the datagridview to be like a listview i guess. https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridview?view=netcore-3.1
  • monster
    Options
    Offline / Send Message
    monster polycounter
    With Treeview you can check what's under the mouse and execute based on the item at the mouse position. It will probably work with list view, but I don't use it.

    It won't look like a button, if that is your goal.

    (
    	rollout tvTest "TV"
    	(
    		dotNetControl tv "System.Windows.Forms.TreeView"
    
    		on tv mouseUp arg do
    		(
    			theNode = tv.GetNodeAt arg.location 
    
    			if theNode != undefined then
    			(
    				--LEFT CLICK
    				if arg.button == mouseButtons.left do
    				(
    					work()
    				)
    				
    				--RIGHT CLICK
    				if arg.button == mouseButtons.right do
    				(
    					work_other()
    				)
    			)
    			else
    			(
    				print "No Node"
    			)
    
    		)
    	)
    	
    	CreateDialog tvTest
    )

Sign In or Register to comment.