Notifications
Clear all

[Closed] Good source for .net controls info?

Thanks Yannick.
The event should be SelectedIndexChanged. So you could do:


on tabControl SelectedIndexChanged sender event do (...)

then just access the tabControl.selectedindex property to get a 0-based index of the selected tab. The event object itself might also hold the index, you might want to do a showproperties on it to check. Then just a big case statement to process the index. You could also do it with registered maxscript functions like (if you’re using it as a dotnetobject as opposed to a dotnetcontrol):


fn tabsSelectedIndexChanged sender event = (...)
dotnet.addeventhandler tabControl "SelectedIndexChanged" tabsSelectedIndexChanged

where tabControl is a variable holding the dotnetobject. Another way to inspect events that I find handy when I don’t want to alt-tab to msdn is just:


t = dotnetobject "System.Windows.Forms.TabControl"
showevents t

You could also inspect the dotnetclass, etc.

Unfortunately you can’t change the colors of the standard tab control. The Forecolor and Backcolor properties do nothing I can post my tab control to download soon; I just need to clean it up a bit.

 PEN

For the tab control I can get the index of the tab using this…is this the best way?


 on tabCtrl Selected arg do
 			(
 				print arg.tabPageIndex
 			)
 

Thanks for the code snippets James. Thanks for sharing your tab control (take the time to clean your code ).

.Net controls are beter and easiest to design and develop than old ActiveX controls.

 PEN

Here is another that I have not been able to make work.

In the treeview I want the tree expanded when it is created. I’m using .expand() but it has no effect at all when I add the nodes. Any suggestions?

Are you applying Expand() method on a TreeNode ? Have you tested ExpandAll or Expand on the parent/root node ?

edit: Sorry Yannick same post

No problem James :). But your post was explaining a bit more the methods Expand() and ExpandAll().

 PEN

Yes I tried expand and expandAll every where that I could apply it without success. Has any one used it and made it work?

Here’s a small example of how they work (comment out the different methods and check out how they differ):


 (
 	rollout treeTest "Tree Test"
 	(
 		dotnetcontrol tv "System.Windows.Forms.TreeView" width:190 height:290 align:#center
 		
 		fn nodeTest =
 			for x = 0 to 3 do
 			(
 				local n1 = x as string
 				local n2 = (x + 1) as string
 				tv.nodes.add ("Test" + n1)
 				tv.nodes.item[x].nodes.add ("Sub" + n1)
 				tv.nodes.item[x].nodes.add ("Sub" + n2)
 				tv.nodes.item[x].nodes.item[0].nodes.add "Double Nested"
 			)
 		
 		on treeTest open do
 		(
 			nodeTest()
 			--tv.expandall()
 			tv.nodes.item[2].expand()
 			tv.nodes.item[3].expandall()
 		)
 	)
 	createdialog treeTest 200 300
 )
 
 PEN

Ah, you are doing it after creation. I just wanted to do it while I as adding the nodes instead of having to run over it a second time. Thanks

Page 2 / 3