[Closed] dotNet UI
You’re in luck
http://www.codeproject.com/Articles/4057/Multi-Select-TreeView-Control-in-C
or
http://bukhantsov.org/2011/09/multiple-selection-in-treeview/
I haven’t tried either of them.
Hi guys, not posted in a while but the dot net form is going well. Have got the treeview working and everything is going to plan(ish).
Is there a way to traverse up and down a folder directory with maxscript?
Say I have a folder location and want to go up to a parent folder or up to a folder more than one step above. Would like to do it with maxscript not dot net, but can implement dot net way if the former cannot be done (which I am sure it can be)
Will continue to research, its probably going to be quite basic but pointers welcome. And some mild abuse would also be ok.
How can i change the color of the actual text in the textbox to be blue and then change to green after it reaches a certain number of characters?
rollout unnamedRollout "Untitled" width:260 height:184
(
dotNetControl textBox "textbox" pos:[16,112] width:232 height:20
)
createDialog unnamedRollout
try(DestroyDialog ::unnamedRollout)catch()
rollout unnamedRollout "Untitled" width:260 height:184
(
fn changeTxtColor ctrl splitAfter:10 =
(
ctrl.forecolor = if ctrl.TextLength <= splitAfter then ctrl.forecolor.DodgerBlue else ctrl.forecolor.LawnGreen
)
dotNetControl textBox "textbox" pos:[16,112] width:232 height:20
on textBox TextChanged arg do changeTxtColor textBox
on textBox GotFocus arg do enableAccelerators = false
on textBox LostFocus arg do enableAccelerators = true
on unnamedRollout open do
(
textBox.BackColor = textBox.BackColor.black
changeTxtColor textBox ; textBox.focus()
)
)
createDialog unnamedRollout
enableAccelerators is not needed if you are using a dotNetControl inside of a rollout like in the example above!
I also believe that if you are using a maxForm you will not need to use enableAccelerators in order to be able to type inside .Net Controls.
Exactly right. Both MaxForms and Rollouts do not require any methods to call enable/disableAccellerators. Annoyingly MaxForms also catch any keyboard shortcuts you have assigned to catch your tool being closed through a macroscript, which is why I prefer using a windows form and handling it all myself.
I was wondering how i can make it so i could select multiple items in this list and right click and edit ‘position’ for just the selected items in the list. Then maybe select a few other items in the list and adjust the ‘wirecolor’ for all those objects.
How can i do this?
try(destroyDialog rlSampler)catch()
rollout rlSampler "The Rollout" width:300
(
button btnRefresh "Refresh"
dotNetControl lv "system.windows.forms.listView" pos:[10,40] width:480 height:400
on testButton pressed do
(
clearListener() --Clear the listener.
format "Props
" --Format a header so we know what we are looking at below.
showProperties lv --Show the properties of the listView control.
format "
Methods
" --Format a header so we know what we are looking at below.
showMethods lv --Show the properties of the listView control.
format "
Events
" --Format a header so we know what we are looking at below.
showEvents lv --Show the properties of the listView control.
)
--Innitialize the listview control
fn initLv theLv=
(
--Setup the forms view
theLv.view=(dotNetClass "system.windows.forms.view").details
theLv.FullRowSelect=true --Set so full width of listView is selected and not just first column.
theLv.GridLines=true --Show lines between the items.
theLv.MultiSelect=true --Allow for multiple selections.
)
--Add columns.
fn addColumns theLv columnsAr=
(
w=(theLv.width/columnsAr.count)-1 --Calculate the width of each column.
for x in columnsAr do --Loop through all the column names to be added.
(
theLv.columns.add x w --Add each new column to the listview control.
)
)
--Adds rows of data to the listView
fn populateList theLv=
(
rows=#() --Empty array to collect rows of data
for x in objects do --Loop through all the objects in the scene.
(
li=dotNetObject "System.Windows.Forms.ListViewItem" x.name --Create a listViewItem object and name it.
li.subitems.add ((superclassOf x) as string) --Add data to the second column.
li.subitems.add (((x.wireColor) as point3) as string) --Add data to the third coumn
li.subitems.add (((x.Position) as point3) as string) --Add data to the forth coumn
append rows li --Added the listViewItem to the rows array
)
theLv.items.addRange rows --Add the array of rows to the listView control.
)
on lv mouseDown arg do
(
clearListener()
showProperties arg
print "---"
hit=(lv.HitTest (dotNetObject "System.Drawing.Point" arg.x arg.y))
showProperties hit
showProperties hit.item
print hit.item.text
showProperties hit.item.subItems
print hit.item.subItems.count
print hit.item.subItems.item[1].text
)
on rlSampler open do
(
initLv lv
addColumns lv #("Object","Class","Wire Color","Position")
populateList lv
)
)
--Create a dialog and assign the rollout to it.
createDialog rlSampler 500 450