Notifications
Clear all

[Closed] Ui Tab

I remember there is an example here on forum, but I can’t find it. I need smth like this:

6 Replies

thx, Denis!

Denis, I like very much this Tab UI that you created:

http://forums.cgsociety.org/showpost.php?p=7097359&postcount=15

But how can I embed it in a rollout with style()?

newrolloutfloater does not accept style() function

try(destroydialog dialog) catch()

rollout dialog "Tabs"
(
	dotnetcontrol tb "TabControl" width:200 height:24 pos:[0,0] 
	group "A Section: "
	(
		button a_bt "Create" width:100
		radiobuttons a_rb "Radio:" labels:#("1","2","3")
	)
	label emp offset:[0,-105] visiblie:on
	group "B Section: "
	(
		button b_bt "Delete" width:100
		radiobuttons b_rb "Radio:" labels:#("4","5","6")
	)
	fn visibleFromGroup name state = 
	(
		setstate = off
		out = off
		for c in dialog.controls while not out do
		(
			if iskindof c GroupStartControl and c.text == name do setstate = on
			if setstate do c.visible = state 
			if iskindof c GroupEndControl and c.text == name do out = on
		)
	)
	fn visiblePage page:0 = 
	(
		for c in dialog.controls where c != tb do c.visible = off
		case page of
		(
			0: visibleFromGroup "A Section: " on
			1: visibleFromGroup "B Section: " on
		)
	)
	on tb selected s e do
	(
		visiblePage page:e.TabPageIndex
	)

	on dialog open do
	(
		tb.itemSize = dotNetObject "System.Drawing.Size" 40 20
		tb.TabPages.add "A"
		tb.TabPages.add "B"
		visiblePage page:0
	)
)
createdialog dialog

here is another way how it could be done

Oh, great! Thank you Denis, You are really the master! Good Job…

this how i do it (variation on something published by Bobo of this parish)

(
 	local 	wintitle = "Window: Scene", winstyle = #(#style_toolwindow,#style_sysmenu, #style_resizing);
 	local	winheight = 488, winwidth = 220, winpos = [6,114];
 	local	tabheight = 40, tabwidth = 32, panelvinset = tabheight + 5, panelhinset = 6, panelpos = [4,tabheight + 1];
 	local	LastSubRollout = 1
 	
 	rollout scene_rollout_1 "scene rollout 1"
 	(
 		button btn1 "Button 1";
 		button btn2 "Button 2";
 		button btn3 "Button 3";
 	)
 	
 	rollout scene_rollout_2 "scene rollout 2"
 	(
 		button btn1 "Button 1";
 		button btn2 "Button 2";
 		button btn3 "Button 3";
 	)
 	
 	rollout scene_rollout_3 "scene rollout 3"
 	(
 		button btn1 "Button 1";
 		button btn2 "Button 2";
 		button btn3 "Button 3";
 	)
 	
 	rollout node_rollout_1 "node rollout 2"
 	(
 		button btn1 "Button 1";
 		button btn2 "Button 2";
 		button btn3 "Button 3";
 	)
 	
 	rollout node_rollout_2 "node rollout 3"
 	(
 		button btn1 "Button 1";
 		button btn2 "Button 2";
 		button btn3 "Button 3";
 	)
 	
 	rollout systems_rollout_1 "systems rollout 1"
 	(
 		button btn1 "Button 1";
 		button btn2 "Button 2";
 		button btn3 "Button 3";
 	)
 	
 	rollout systems_rollout_2 "systems rollout 2"
 	(
 		button btn1 "Button 1";
 		button btn2 "Button 2";
 		button btn3 "Button 3";
 	)
 	
 	rollout systems_rollout_3 "systems rollout 3"
 	(
 		button btn1 "Button 1";
 		button btn2 "Button 2";
 		button btn3 "Button 3";
 	)
 
 	
 	fn DotNetImageListFromStrip stripfile w h =
 	(
 		bmClass = dotNetclass "System.Drawing.bitmap"
 		imagelist = dotnetobject "System.Windows.Forms.ImageList"
 		imageList.imagesize = dotnetobject "System.Drawing.Size" w h;
 		imageList.ColorDepth = (dotNetclass "System.Windows.Forms.ColorDepth").Depth32Bit
 		bm = bmClass.fromfile stripfile;
 		imageList.images.AddStrip bm;
 		imageList;
 	)
 	
 -- #(title string, tab image, rollout array, rolledup status array, window height)	
 	
 	theWin_Rollouts = 
 	#(
 		#("Scene",0,#(scene_rollout_1, scene_rollout_2, scene_rollout_3),#(false, false, true),388),
 		#("Node",1,#(node_rollout_1, node_rollout_2), #(false,false),275),
 		#("Systems",2,#(systems_rollout_1, systems_rollout_2, systems_rollout_3),#(false,true,false),400)
 	)	
 		
 	rollout theWindow wintitle 
 	( 
 		dotNetControl theTabCntrl "System.Windows.Forms.TabControl" height:40 width:winwidth align:#left offset:[-12,-4]
 		subrollout rollouts pos:panelpos height:(theWindow.height - panelvinset) width:(theWindow.width - panelhinset)
 		
 		on theWindow resized pnt do 
 			rollouts.height = (theWindow.height - panelvinset);
 		
 		on theTabCntrl Selected item do
 		(
 			if LastSubRollout != (item.TabPageIndex + 1) do --do not update if the same tab clicked twice
 			(
 				for sr in theWin_Rollouts[LastSubRollout][3] do
 					removeSubRollout rollouts sr;
 				LastSubRollout = item.TabPageIndex + 1;
 				for sr = 1 to theWin_Rollouts[LastSubRollout][3].count do 
 					addSubRollout rollouts theWin_Rollouts[LastSubRollout][3][sr] rolledUp:theWin_Rollouts[LastSubRollout][4][sr]	
 				
 				theWindow.height = theWin_Rollouts[LastSubRollout][5];
 				theWindow.title = "Window: " + theWin_Rollouts[LastSubRollout][1];
 			) 
 		)	
 		on theWindow open do
 		(
 			theTabCntrl.ImageList = DotNetImageListFromStrip ((getdir #ui) + "Icons/Systems_24i.bmp") 24 24;
 			theTabCntrl.SizeMode =  (dotnetclass "System.Windows.Forms.TabSizeMode").Fixed;
 			theTabCntrl.ItemSize =  dotnetobject "System.Drawing.Size" tabheight tabwidth;
 			
 
 			for aTab in theWin_Rollouts do
 				theTabCntrl.TabPages.add aTab[1] "" aTab[2]
 			theTabCntrl.SelectedIndex = LastSubRollout - 1;
 			
 			for sr = 1 to theWin_Rollouts[LastSubRollout][3].count do 
 				addSubRollout rollouts theWin_Rollouts[LastSubRollout][3][sr] rolledUp:theWin_Rollouts[LastSubRollout][4][sr]	
 			
 			theWindow.height = theWin_Rollouts[LastSubRollout][5];
 			theWindow.title = "Window: " + theWin_Rollouts[LastSubRollout][1];
 		)
 		on theWindow close do
 		(
 			theTabCntrl.ImageList.Dispose();
 		)
 	)
 		
 	createdialog theWindow width:winwidth height:winheight pos:winpos style:winstyle lockWidth:true
 )