Notifications
Clear all

[Closed] dotnet listview look / feel like MultiListBox ?

Hi Joel,

You’re welcome!

So you actually wanted to be able to color any item a different foreground color? I’ll look into that but Im not sure if it’s straightforward from the small amount i found on custom listboxes on the web. There might be a control on one of the code sites that does what you ask.

As for resources, I dont actually use C#, all my controls are written in VB. the great thing about dotnet is that you ca reference C# classes in Visual studio and use them in another language, as the method/function/property calls are identical. So for example the trackbar I posted earlier in the week uses a C# component referenced in the VB class library. For me, VB seemed much easier to grasp for my feeble brain. I have just spent the last year hitting the books and the web hard over the subject!

glad the control worked for you! cheers, Pete

Here’s a thought – you could imlpement individual item color control with a set of private color properties. These would be hidden and accesible via a public method something like itemforecolor <itemindex> <color>
Then, when the control draws itself it looks for a color property for that item index. if not, it defaults to the forecolor. This is only useful if you want absolute control over the item color. Since you can call it anytime, you could filter the colors per item when you populate the listbox. This would mean a color per item, and without iterating through something that you dont know how many, you could set up color properties for, say the first 30 items? or more but it depends how you think the control will be used. Its a nasty solution true, but just my first thoughts. :shrug: im happy to implement this solution into the control if you thought it would be useful.

Interesting that you use VB. Either way I dont have much experience with compiled languages, lots of maxscript and a small amount of python are all I have time for at the moment. I bought a C++ some time ago but I haven’t gotton around to starting it yet…

I’m not quite sure I understand exactly what you mean by this. I get the first part about setting custom colors via a public method but you lost me when you started talking about the first 30 items. 30 may be enough but I would prefer not to limit it to just 30. Check out the Xref Scene Dialog’s ListBox to see what I’m going for. When you disable an xref and it’s not selected, the item’s forecolor becomes a light red color. I’d prefer the ‘disabled color’ to remain whether it is selected or not. Either way I’m guessing that the ‘on checked’ event is set to trigger the color change in the selected items. If your solution works something like this and you’re still happy to implement it then I’m happy to let you
Thanks again!

Hi joel,

30 was a number i just plucked out of my head, you could have more but it would have to ‘hardcoded’. Having properties in the control is the same as storing parameters in a maxplugin. It’s only different in that i would disable them from editing directly by making them private. that way, a single method can set them from inside the class.

This is why my idea is not terribly scalable. however, for what you want maybe a listview would give you that control. However, you could trigger the change in color if you have a callback method that notifies when you’ve disabled an xref. I guess you would have to keep repopulating the control according to the object’s state that you are using. As it is drawing the listbox items manually, it would reflect this change almost immediately. I might not be grasping fully the kind of thing you’re doing here though so I might be way off. cheers!

Pete thanks again for your help. I’ve got a ListView solution working for now. I guess it’s just a nit-picky thing because I don’t need / want the marquee selection in there. Besides that it seems to work fine.

Maybe creating a solution for the ListBox that is more dynamic than hardcoding, can be my motivation for learning a compiled language.

Cheers Pete. This one’s on me:

IMHO:
Unless you know you want to invest the time in some serious theory from the outset, or have to write to existing code, I wouldn’t start with C++, these days, when there are other languages like C# around. C++’s advantages lie at a lower programming level than you probably need to go, and its disadvantages lie in having to do your own memory management, and numerous subtle gotchas that are a natural consequence of its power at that lower level.

2 Replies
(@gravey)
Joined: 11 months ago

Posts: 0

I thought it might be useful to know C++ for writing compiled max plugins some day, however I have no immediate need to do so, so thanks for the tip. I have heard good things about C# so I’ll most likely start on that when I get a chance. Perhaps you know of some good resources for getting started?

(@drdubosc)
Joined: 11 months ago

Posts: 0

Oops! I thought you might ask that, and since I came across from C++ ( which is very like C#), I went straight to the Visual Studio help, MSDN articles and reference, and the internet sources. That might not be very helpful, but if you’ve picked up enough OOP from Python, that might be OK. You can almost always rely on O’Reilly books to be concise and not waste your time.

There are 3 bits to learn really, not necessarily in this order: 1.General OOP, 2.the language’s syntax and good style, and 3. whichever library or framework you’re calling from the language, to build your projects. 1 can help speed up searching and making sense of the references in 3.

C# might be to too closely associated with MS and .net, if plugins are your priority. I have to admit the struggle for me is 3, (the Max SDK) at the moment, so you might find, if you learn C++ for it, the job is only half done!

not to mention it makes b*gger all sense!

hi joel, i obviously look for more vb orientated sites, but i have used http://www.csharpcorner.com/ and www.codeproject.com is still a place i visit a lot. The web is literally teeming with info but i like to hit the books first to get a grasp! i just searched amazon and read the reviews!

Pete:
Thanks for those resources. I’ve just made an executive decision to start learning sooner rather than later.

drdubosc:
Thanks for the tips. I did mension max plugins however I’ve been using dotnet through maxscript quite a bit lately so it seems to be the more logical path. I’ll check out those O’Reilly books too.

Thanks again guys

this was the biggest thing for me. I thought i understood OOP until i learnt a bit of dotnet. About half way through a big penny dropped and I started to use it properly. I can honestly say it is a great thing to start learning. I just got a WPF book through from amazon this morning after our post on the GDI thread!

Page 2 / 3