View Full Version : Extra columns of Check boxes in a Listview?

03 March 2008, 02:37 PM
Hi Guys,

I hvae been slowly making some quike exciting progress implementing some .NET UI stuff. I am currently trying to replace a standard Max multiListBox with a much more functional Listview with a couple of columns of checkboxes to turn different features on and off.

Now to get these additional columns of checkboxes (see picture attached) do I still want to be working with a ListView, or would another type of UI Element be more appropriate? I have the functionality for the checkboxes on the left working nicely. But these are native to the List View, by setting the "ListView.checkboxes = true" property.

Is it hard to add information/checkboxes to additional Listview columns? Or am I going about it in the wrong way....

Any advice/examples would be really helpful...

I have included the code that I have developed so far for others that are trying to learn. I am utterly new to this, and these lines of code are heavily inspired by a lot of the more advanced members of this forum. Cheers guys :)

Local lvItems = #("Bob","Ben","Bill","Fred","Sally") --Some random Names for the ListView
dotNetControl lv "System.Windows.Forms.ListView" width:152 height:275 pos:[4,44]

fn ListViewProcess =
lv.checkboxes = true --Enable Checkboxes in the listview (down the left hand side)
lv.Columns.add "Col1" 100 --Add a Column
lv.Columns.add "Col2" 50 -- Add another Column

lv.View = (dotNetClass "System.Windows.Forms.View").Details -- Allow Grid layout

--Setup Custom Images and add them to the Image List to represent the checkbox states
CustomImageList = dotnetObject "System.Windows.Forms.ImageList"
CustImageUI = dotNetClass "System.Drawing.Image"
CustomImageList.Images.Add(CustImageUI.FromFile "C:\UnCheckedImage.jpg")
CustomImageList.Images.Add(CustImageUI.FromFile "C:\CheckedImage.jpg")

ListNo = lvItems.count
theRange = #()

for i = 1 to Listno do
li = dotNetObject "System.Windows.Forms.ListViewItem" lvItems[i]
append theRange li --Create and create the Listview Items
)--End of for

lv.Items.AddRange theRange --Add them to the ListView

lv.stateimagelist = CustomImageList --Set the Checkbox images in the ListView to our CustomImages

)--End of function ListViewProcess

Thanks for your time everyone :)


03 March 2008, 12:36 PM
ListView controls don't provide the functionaility you require. Only the first column can, techniqually, have a check box.

The other approach you can take is providing some sort of custom draw routine, but it be honest, you'd be better off doing in C# or equivilent language as the performance drag from max would just simple make life to difficult.

There might be a better control avaliable in dot net, but I don't have the docs handy to look it up at the moment.


03 March 2008, 02:41 PM
Why not have 2 listviews next to each other?
I think Lights layerman does the same ( -> layerman)...


03 March 2008, 04:28 PM
hopefully ADSK will see fit to properly expose the control used by Scene Explorer; that would, seemingly, readily do what you'd need.

03 March 2008, 04:55 PM
Are there no nice little free .NET controls out there that do what you need?

I know that with AX there were quite a few that would do the job, it was just tricky getting access in MXS to the exposed properties. I was hoping that .NET was going to change all that.

03 March 2008, 04:57 PM
It's already exposed in MaxCustomControls.dll (from 3ds Max .NET SDK - Max 2008):

dotNet.loadAssembly "MaxCustomControls.dll"

rollout ExplorerControlRollout "Explorer Control Rollout" width:400 height:250
dotNetControl explorer "MaxCustomControls.ExplorerControl" pos:[10,10] width:380 height:230
createdialog ExplorerControlRollout

But it's not useful as it was specifically designed for the Scene Explorer.
I'm sure there's already such .NET User Control on the web allowing to set chechboxes in whatever column we want.

03 March 2008, 06:47 PM
ah, Cool Yannick!

But yes, after looking at some of the methods and properties, it does look like it's not quite abstract enough (as you said, very much tailored to being a 3ds max scene nodes explorer).

Was worth a shot :)

03 March 2008, 10:08 PM
I think the datagrid is the only other control that might come close to doing what you want, problem is, you are going to need to attach a datasource to the grid to drive it. Good news, is you can use a xml datasource rather then a SQL based datasource, could be worth looking into


CGTalk Moderation
03 March 2008, 10:08 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.