[Closed] dotnetobject "UserControl" Maximum Size
Currently I use a container with btns that I can scroll. I found that there is an winapi restriction for dotnetobject “UserControl” that I use. It’s Maximum Size is 65535. Btns below this value are displayed with errors and overlapping.
Is there any other container that I might use instead of "UserControl" that does not have such limitation?
dotnetobject “ContainerControl” and dotnetobject “Panel” have the same limitation.
It seems to me that I should split my btns in 3 small subcontainers and change them periodically.
Why by all means you want to use such large controls ?
This sounds like a bad design decision in my eyes …
not necessarily. it’s something about a ‘timeline’ or ‘spreadsheet’… a long scrollable control
For spreadsheets ( datagrid, listviews etc… ) i guess using virtualmode would be better then…
I would assume that even for other usages which require those dimensions, custom scrolling and drawing would work better too ( performance wise ).
It’s a operating mode of those controls ( activated by setting the virtualmode property to true ), where the cells are created on the fly, when they come to view ( you’ll have to handle some special events to know which cells will going to be displayed ). This prevents you from having to build all cells from the beginning ( which can be 100 of thousands with huge data ) and only maintain a small subset of your dataset. With that implemented, you can have virtually endless scrolling gridviews etc …
More details here …
https://msdn.microsoft.com/en-us/library/ms171624(v=vs.110).aspx
For the Listview
https://msdn.microsoft.com/en-us/library/system.windows.forms.listview.virtualmode(v=vs.110).aspx
Very interesting. I will have to investigate this, of course! It’s sad that there are not examples of this made in maxscript for datagrid.
what about selecting all the items from the list? Let’s say, I press CTRL+A and then I want to apply an operation to all list items. In this case, only a few items will be selected instead.
I don’t know in detail how those cases are handled, but i guess there are some special events for this so that you know on what selection of your data to perform operations.
You always should keep data seperated from the “view” anyways, in the case of virtualmode this is mandatory. Like the MVC design pattern suggests
What kind of data you want to show? just one direction buttons? WPF ItemsControl (ListBox,ListView) are virtualized by default.
https://msdn.microsoft.com/en-us/library/cc716879(v=vs.100).aspx
But if you want to change its panel(for example WrapPanel), you had to handle its virtualization yourself.
I remember that PEN was meeting the same problem. I remember for sure that I couldn’t find a solution.
maybe PEN has anything working?
This example shows how to use WPF ListView inside Maxscript:
TheWindow = dotnetobject "System.windows.Window"
TheWindow.width = 150
TheWindow.showintaskbar = false
TheWindow.show()
(dotnetobject "System.Windows.Interop.WindowInteropHelper" TheWindow).owner = dotnetobject "IntPtr" (windows.getMAXHWND())
TheListView = dotnetobject "System.windows.controls.ListView"
for i = 1 to 500 do
(
Item = dotnetobject "System.windows.controls.Button"
Item.width = Item.height = 100
Item.content = i as string
TheListView.items.add Item
)
TheWindow.content = TheListView
Mehdi Zangeneh, thank you very much for such a wonderful example.
I wish to be able to use it for the left btns like in this image:
I thought even to create 2 dotnetobject Listviews just like in your example, close to each other, so that for multimaterial I will have IDs on the right and material to the left, and this will work, but in the case of usual materials, I will have a wide btn that should be a part of 2 lists, and this will be more difficult. Would it be possible to make 2 btns from 2 different listviews look and act like one single btn?
OMG, the text should be alighned in the middle, I think this is a bad idea.
I think I need to have 4 such listviews included in a container and linked to the main datagrid that I have to the right. But this is also a headache
I started to virtualize by myself this kind of btns. Half of it is done already with 2 smaller subcontainers that will change periodically, so that the user will fill that btns scroll like they should