[Closed] Scripting Rollouts for tabs
if you interested i can show how simply modify my sample to make it work with tabs…
Yeah that would be greatly appreciated. I’m trying to explore and see all possible routes before making a decision and going with it. So this example would be great to see.
There’s an example here in the forum from Bobo or Denis that I think it uses the .visible property of the subrollouts or rollouts, can’t quite remember. It’s main structure is basically what’s written on the maxscript help with that minor cosmetic change.
here is another way… using rollout border style:
try(closeRolloutFloater dialog) catch()
struct rolloutData (this, title, open = off, border = on, controls = #())
struct controlData (this, 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 this: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 this:rol title:rol.title open:rol.open controls:controls
)
fn setRolloutData data = if data != undefined and iskindof (rol = data.this) RolloutClass do
(
rol.title = data.title
for c in data.controls where (finditem rol.controls c.this) != 0 do
(
if c.data != undefined do for d in c.data do setproperty c.this d[1] d[2]
c.this.enabled = c.enabled
c.this.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()
Edit… Made rollouts A and B local to main Rollout…
Here it is http://forums.cgsociety.org/showthread.php?f=98&t=991728&highlight=Subrollout
Sorry if this is the same Denis posted but I can’t scroll whats on Code tags on the iPad.
Alright
These are all great ideas. I’m going to build out some concept and see what I come up with. I’ll be sure to share it with you guys and let you know how it works as well.
Thanks
JokerMartini