Notifications
Clear all

[Closed] Tabs and UI components

Hello

I’ve searched this forum about a problem I have, and still not found exactly what I’m looking for … To summarize: I need to do a script interface using tabs. I managed to get the tabs I want. Now I’d like to put directly my UI components (checkboxes, sliders and so on) in the tab “window”, without using any kind of rollout in the tabs …
Please check the code sample I’m on so far … but I don’t want/need to use rollouts


 (
 	global VFBTabs 
 	try(destroyDialog VFBTabs)catch()
 	
 	local LastSubRollout = 1
 	
 	rollout VFBTabsRollout01 "Rollout 01"
 	(
 		spinner spn_spinner "Spinner"
 	)
 	rollout VFBTabsRollout02 "Rollout 02"
 	(
 		button btn_button "Button"
 	)
 	rollout VFBTabsRollout03 "Rollout 03"
 	(
 		label lbl_label "This is some text"
 	)
 	rollout VFBTabsRollout04 "Rollout 04"
 	(
 		colorpicker clr_picker "Color Picker"
 	)
 	rollout VFBTabsRollout05 "Rollout 05"
 	(
 		checkbox chk_box "Checkbox"
 	)
 	
 	VFBTabs_Rollouts = #(
 		#("Global Options",#(VFBTabsRollout01)),
 		#("GI & Skylight",#(VFBTabsRollout02)),
 		#("Raytracer",#(VFBTabsRollout03)),
 		#("Blurries Manager",#(VFBTabsRollout04))
 	)	
 	
 	rollout VFBTabs "VFB-Tabs"
 	(
 			dotNetControl dn_tabs "System.Windows.Forms.TabControl" height:20 width:420 align:#left
 			subRollout theSubRollout width:658 height:190 align:#center
 			
 			on dn_tabs Selected itm do
 			(
 				if LastSubRollout != (itm.TabPageIndex+1) do --do not update if the same tab clicked twice
 				(
 					for subroll in VFBTabs_Rollouts[LastSubRollout][2] do
 						removeSubRollout theSubRollout subroll
 					for subroll in VFBTabs_Rollouts[LastSubRollout = itm.TabPageIndex+1][2] do	
 						addSubRollout theSubRollout subroll
 				) 
 			)--end tabs clicked		
 			
 			on VFBTabs open do
 			(
 				for aTab in VFBTabs_Rollouts do
 				(
 					dn_tabs.TabPages.add aTab[1]
 				)
 				for subroll in VFBTabs_Rollouts[1][2] do 
 					addSubRollout theSubRollout subroll				
 			)
 	)
 
 	createDialog VFBTabs 658 190
 )	
 
 
13 Replies

Seems to me that a more “correct” approach would be to use .net controls directly inside the tabs, instead of trying to combine it with standard MAX controls. That way you can use the .NET methods for adding controls instead of having to use the rollout method.

Nice to see ya here Nicolas… =D

1 Reply
(@nicolasc)
Joined: 11 months ago

Posts: 0

Hi Marco

Ok, I understand your point of view, but would you have any sample to show or better, a direct addition to my script (in the first tab for example) ? Honestly, I’m only starting to use dotNet, and I don’t like it very much … matter of practice certainly

Best regards.

Here’s something I coded up real quickly:

 (
 	--Create scroll bars (for later use in the textbox)
 	ScrollBars = dotNetClass "System.Windows.Forms.ScrollBars"
 	--Create the first tab 
 	newTab = dotnetobject "System.Windows.Forms.TabPage"
 	newTab.text = "hello"
 	--Create a textbox and set properties
 	TB1TextBox = dotNetObject "System.Windows.Forms.TextBox"
 	  TB1TextBox.Location = dotNetObject "System.Drawing.Point" 10 10
 	  TB1TextBox.Width = 365
 	  TB1TextBox.Height = 120
 	  TB1TextBox.Visible = true
 	  TB1TextBox.MultiLine = true
 	  TB1TextBox.ScrollBars = ScrollBars.Vertical
 	  TB1TextBox.AcceptsReturn = true
 	  TB1TextBox.AcceptsTab = true
 	  TB1TextBox.WordWrap = true
 	--Create a button and set properties 
 	button01 = dotnetobject "System.Windows.Forms.button"
 	button01.text = "Click me"
 	button01.Location = dotNetObject "System.Drawing.Point" 300 138
 	 --Add textbox and button to first tab
 	newTab.controls.add TB1TextBox
 	newTab.controls.add button01
 	--Create second tab
 	newTab2 = dotnetobject "System.Windows.Forms.TabPage"
 	newTab2.text = "goodbye"
 	--Create a tab control object and set properties
 	TabControl = dotnetobject "System.Windows.Forms.TabControl" 
 	 tabControl.size = dotnetobject "system.drawing.size" 400 225
 	tabControl.Location = dotnetobject "System.Drawing.Point" 0 0 
 	--Add the tabs to the tab control
 	TabControl.controls.add newTab
 	TabControl.controls.add newTab2	
 	-- Create Form (this is sort of like the rollout creation in maxscript) and set properties
 	  TabForm = dotNetObject "System.Windows.Forms.Form"
 	  TabForm.Size = dotNetObject "System.Drawing.Size" 400 225
 	  TabForm.Text = "Title"
 	  TabForm.TopMost = true
 	  FormBorderStyle = dotNetClass "System.Windows.Forms.FormBorderStyle"
 	  TabForm.FormBorderStyle = FormBorderStyle.FixedDialog
 	  TabForm.ShowInTaskbar = false
 	  TabForm.MinimizeBox = true
 	  TabForm.MaximizeBox = false
 	  Tabform.helpbutton = true
 	--Add the tab control to the form
 	 TabForm.Controls.Add(tabcontrol)
 	--Show the form (sort of like createDialog)
    TabForm.showdialog()
 )

You’ll notice that this is straight .net stuff… no maxscripts rollouts. And yes it will be confusing to understand at first… until you get the hang of it. NET can be a real bitch when it feels like.

Let me know if you still have problems.

Oh, cool ! let me check that !

Hi Nicolas,

There’s a TabControl for MAXScript that was developed by Rezn8 studio that is way better than the .NET Form TabControl. It’s very powerful because you have just to add a rollout as a tab page and avoid hiding/showing stuff or having to use .NET controls.

To download the Rezn8 DLX :

http://www.maxplugins.de/r9_files/rezn8/rezn8mxs_max9_v1.34.zip
or
http://www.maxplugins.de/r2009_files/feltman/rezn8mxs_Max2009_v1.34.zip

See the help and examples sources for more information.

PS: In this DLX there’s also a SplitterControl that is useful too…

Hello Yannick,

Thanks a lot for your suggestion, it seems highly interesting !! If I can avoid converting all my script (mostly already ready) to .Net, I’ll be happy for sure I’ll check that ASAP.

Thanks again,

Regards.

Hey, Yannick, thanks for the tip. I was dealing with tabs some time ago and that would have been quite useful

NicolasC, I remember a couple of threads in this section talking about .NET and rollouts in tabs. They shouldn’t be hard to find, and it’s plenty of information in there.

Hello,

Yes, I know, I’ve searched the forum before posting but you know, if I can avoid using .NET, or at least minimize the use of it, I’ll feel better !

Regards.

I’ve discovered a bad, bad thing when I wanted to share my WIP-script with a friend using max2009 64b … rezn8 extensions aren’t available for 64b !!! and his support email adress isn’t valid anymore apparently … any idea, please ?

Thanks in advance !

you might contact Dave from maxplugins.de

@maxplugins.de” data-bbcode=”true”>dave@maxplugins.de

i don’t know if it’s true for the rezn8 extension, but he has access to many of the free plugin’s sourcecode. But maybe there’s a specific reason for 32 bit only, i guess activex dependency

Page 1 / 2