Notifications
Clear all

[Closed] CTabCtrl 3dsmax sdk

So after building a large UI in .net and maxscript I have found no way to talk 3dsmax on changes to update the UI.

I put together a utility plugin that communicates with max very well. Very happy with it. The last thing I want to do is add a tab system.

Is there a way of using tabs in the utility plugin? Would c++ and .net be a better way? I have not found any samples on this. Has anyone done this?

Thanks

4 Replies
try(closeRolloutFloater dialog) catch()
struct rolloutData (self, title, open = off, border = on, controls = #())
struct controlData (self, data, enabled, visible)

global main, dialog
rollout main "main"
(
	local secA, secB 
	rollout secA "A"
	(
		local data = if data != undefined do data
			
		radiobuttons rb labels:#("High", "Low") across:2
		spinner sp "A: " range:[0,1e9,1] type:#integer fieldwidth:40
		
		on secA close do data = main.getRolloutData secA
		on secA open do if data != undefined do main.setRolloutData data
	)
	rollout secB "B"
	(
		local data = if data != undefined do data
			
		checkbox cb "Enabled" checked:on across:2
		spinner sp "B: " range:[0,1e9,2] type:#integer fieldwidth:40
		
		on secB close do data = main.getRolloutData secB
		on secB open do if data != undefined do main.setRolloutData data
	)

	fn getControlData control = 
	(
		data = case (classof control) of
		(
			SpinnerControl: 
			#(
				#(#value, control.value),
				#(#range, control.range)
			)
			CheckBoxControl: 
			#(
				#(#tristate, control.tristate),
				#(#controller, control.controller)
			)
			RadioControl: 
			#(
				#(#state, control.state)
			)
		)
		controlData self:control data:data enabled:control.enabled visible:control.enabled
	)
	fn getRolloutData rol = 
	(
		controls = for c in rol.controls where (data = getControlData c) != undefined collect data
		rolloutData self:rol title:rol.title open:rol.open controls:controls
	)
	fn setRolloutData data = if data != undefined and iskindof (rol = data.self) RolloutClass do
	(
		rol.title = data.title
		
		for c in data.controls where (finditem rol.controls c.self) != 0 do
		(
			if c.data != undefined do for d in c.data do setproperty c.self d[1] d[2]
			c.self.enabled = c.enabled
			c.self.visible = c.visible
		)
		rol.open = data.open 
	) 
	
	dotnetcontrol tb "TabControl" width:200 height:24 pos:[10,0] 
	
	fn stateRollout rol dialog:dialog state:on =
	(
		(if state then addrollout else removerollout) rol dialog border:off
	)
	
	on tb selected s e do
	(
		case e.TabPageIndex of
		(
			0: 
			(
				stateRollout secB state:off
				stateRollout secA state:on
			)
			1: 
			(
				stateRollout secA state:off
				stateRollout secB state:on
			)
		)
	)
		
	fn updateRolloutStates = 
	(
		tb.TabIndex = case of 
		(
			(finditem dialog.rollouts secA != 0): 0
			(finditem dialog.rollouts secB != 0): 1
		)
	)
	
	on main open do
	(
		tb.itemSize = dotNetObject "System.Drawing.Size" 40 20
		tb.TabPages.add "A"
		tb.TabPages.add "B"
	)
)
dialog = newrolloutfloater "Dynamic" 202 200
addrollout main dialog border:off
addrollout main.secA dialog border:off
main.updateRolloutStates()

just copied an example from my archive. it uses TabControl from .net forms

Thanks denis, I have a great version for maxscript.

I want to add tabs to my utility plugin in c++ using .net. I have a lot of the talk back working in the c++ UI so, I just missing the tabs to complete the UI.

Thanks and sorry I might not have explained my self to well in first post.

Is there a way of using tabs in the utility plugin? Would c++ and .net be a better way? I have not found any samples on this. Has anyone done this?

theres an example of c++ tab control usage in render effects, blur project in the samples (you do know that .net is a c# wrapper to the core c++ win32 library where ui controls are concerned)

Klvnk, thanks I will go thought the samples. I didn’t know there was one.

Klvnk, one quick question for you from one of your function publishing example. I almost have it working. The problem is in our OpenDialog(); I know I’m connecting to the plugin by opening it in the Utilities panel and calling …


CloseDialog() { if(theSpringboard.hDlg != NULL)  DestroyWindow(theSpringboard.hDlg); }

It shuts it down fine.

To open it…


void Springboard::OpenDialog(){
	this->Init();
	theSpringboard.hDlg = hDlg;
	CenterWindow(hDlg, GetParent(hDlg));
}

but this only works if we have it open. It will open a fresh one.

But if we go into 3dsmax and call it fresh, nothing happens.

Any pointers on what I’m doing wrong?

Thanks