PDA

View Full Version : Active X Control


mahaelgewely
10-16-2008, 07:43 PM
hello guys,

my question may be a silly or a bad user question. But really i do not know it.
when adding a tab bar within my interface, i cannot add or remove more than 2 rollouts to each tab . WHERE IS THE PROBLEM?

PEN
10-17-2008, 01:34 PM
We would have to see code to know what you are doing or not doing. Also why are you using AX Controls? Are you in Max 8?

mahaelgewely
10-18-2008, 09:39 AM
i am using 3dmax 9 . if there is a different way to make tabs please tell me about it .
thank you.



rollout r1 "Candilis Cellular Automata"
(
activeXcontrol AXC1 "MSComctlLib.TabStrip.2" height:20
subRollout EmptySubRollout height:305 ---------------- empty rollout to include folded rollouts

-- Naming tabs--------------------------------------------
on r1 open do
(
AXC1.tabs[1].caption = "GAME OF LIFE "
AXC1.tabs.add pvCaption: "Clustering"
AXC1.tabs.add pvCaption: "Voronoi"
AXC1.tabs.add pvCaption: "Boolean Algebra"


)

-- rollout navigation control------------------------------
on AXC1 Click do
(

case AXC1.SelectedItem.index of

(

1:(

removeSubRollout EmptySubRollout p2

addSubRollout EmptySubRollout p1

)
------------------------------------------------
2:(

removeSubRollout EmptySubRollout p1

addSubRollout EmptySubRollout p2

)
)
)
)

--------------------------------------------------------------------------------------------------------------------------------------

rollout p1 "Site restrictions" width:280 height:289
(


GroupBox grp10 "Site restrictions" pos:[4,14] width:303 height:77
spinner spn7 "X- Dimension" pos:[69,34] width:123 height:16
spinner spn9 "Y- Dimension" pos:[69,63] width:123 height:16 range:[0,100,0]

GroupBox grp33 "Building restrictions " pos:[4,96] width:303 height:79

spinner spn10 "No of Stories " pos:[67,118] width:125 height:16 range:[0,100,0]
spinner spn33 "Court Diameter" pos:[65,144] width:127 height:16 range:[0,100,0]



GroupBox grp45 "Generate Alternatives " pos:[4,179] width:303 height:106
radiobuttons rdo11 "No of Prototypes" pos:[11,202] width:186 height:30 labels:#("1", "2", "3", "4", "5", "6") columns:6
button btn1 "Generate" pos:[41,240] width:127 height:37


-- variables: Xmax Ymax NoGen CourtDia Alternatives

------------------------------------------ function starts here ---------------------------------------------------------

fn FormGeneration A B C D E =
(

for h= 1 to E
do(

-- creating first generation grid


for x= 0 to (A/3.60) by 1.00 do for y= 0 to (B/3.60) by 1.00 do (
MyPlane= Box length:3.60 width:3.60 Height:3.60 lengthsegs:1 widthsegs:1
MyPlane.name= ("Cell_" + x as string + "_X_" + y as string + "_X_0.0"+ h as string )
MyPlane.pos = [(3.60*x),(3.60*y),0]
MyPlane.wirecolor= [190,200,170]

hide( for o in geometry where distance o.center [(A/2),(B/2),0] > ((D+3)*3.60) and distance o.center [(A/2),(B/2),((C/2)*3.60)]< B collect o)
hide( for o in geometry where distance o.center [(A/2),(B/2),0] < (D*3.60) collect o)
)
-- for o in geometry where try(o.ishidden== false) catch (false) do
for o in geometry where try(o.ishidden== false) and (classof o == box) catch (false) do(

state= random 0 1

if (state == 0) then hide o
)

for gen=0.0 to C by 1 do
(
-- first pass: neighbors information

StateArray = #() -- array to save each cell neighboring status
lifeORdead= #() -- array to save each cell status
Idx=1 -- initialize a conter for StateArray Index
for x=1 to ((A/3.60) -1) by 1.00 do for y=1 to ((B/3.60)-1) do
(
-- defining each cell to collect it's neighbor visibility
NameOfCell= ("Cell_" + x as string + "_X_" + y as string + "_X_" + gen as string + h as string)
print NameOfCell

visible= 0 -- number of visible cell's neighbors

for i= -1 to 1 do for j= -1 to 1 do
(
if (i==0 and j==0) then (

LifeorDeadCell= execute (" $'"+ NameOfCell + "'.ishidden" )
if (LifeorDeadCell == false) then ( lifeORdead[Idx]= 1)
else (lifeORdead[Idx]= 0)
)


else(
-- defining cell NeighborName
NeighborName= ("Cell_" + (x+i) as string + "_X_" + (y+j) as string + "_X_"+ gen as string + h as string)
checkclass = execute ("classof $'" + NeighborName + "'== Box")

if try (checkclass) catch (false) do
(

Visibility= execute ("$'"+ NeighborName + "'.ishidden" ) -- check cell neighbor visibility

if (visibility == false) then (visible= visible+1) -- update number of visible neighbors
else (visible=visible)
)
)

)

StateArray[Idx]= visible -- placement of visible cells no in the cell index of the StateArray
Idx=Idx+1 -- move to the next cell
)



-- second pass: applying rules

Idx=1 -- initialize variable to loop betwenn cells
for x=1 to (A-1) do for y=1 to (B-1) do
(
TotoPlane= box length:3.60 width:3.60 Height:3.60 lengthsegs:1 widthsegs:1
TotoPlane.name= ("Cell_" + x as string + "_X_" + y as string + "_X_"+ (gen+1) as string + h as string)
TotoPlane.pos = [(3.60*x),(3.60*y),((gen+3.60)+(0.2*(gen+3.6)))]
TotoPlane.wirecolor= [190,200,170]

--Conway's Game of Life:
--1. Any live cell with fewer than two live neighbors dies, as if by loneliness.
--2. Any live cell with more than three live neighbors dies, as if by overcrowding.
--3. Any live cell with two or three live neighbors lives, unchanged, to the next generation.
--4. Any dead cell with exactly three live neighbors comes to life.

-- if live cell



Visibility01= " $'"+ TotoPlane.name + "'.ishidden"+ " = true"
Visibility02= " $'"+ TotoPlane.name + "'.ishidden"+ " = false"
if (lifeORdead[Idx]==1) then (


case of
(
(StateArray[Idx]<2): execute Visibility01
(StateArray[Idx]>3): execute Visibility01
(StateArray[Idx]==2): execute Visibility02

(StateArray[Idx]==3): execute Visibility02
)
)

else (
case of
(

(StateArray[Idx]==3): execute Visibility02

(StateArray[Idx]!=3): execute Visibility01
)

)
Idx=Idx+1 -- move to the next cell

)
redrawViews()

)


delete (for o in objects where (o.ishidden == true) collect o)

UnionArray =(for o in objects where distance o.center [(A/2),(B/2),(C/2)] < (A+10) collect o)
uni = UnionArray[1]
for s in UnionArray do (uni + s)

move UnionArray [1] [50,(20*h),0]
delete (for o in objects where distance o.center [(A/2),(B/2),(C/2)] < (A+10) collect o)
for o in objects do (o.name= uniquename "prototype")
--move (for o in objects where distance o.center [(A/2),(B/2),(C/2)] < A collect o) [50,(10*h),0]

freeze(for o in objects where distance o.center [(A/2),(B/2),(C/2)] > (A+10) collect o)
)

)
------------------------------------- function ends here ---------------------------

on btn1 pressed do
(
print spn7.value
print spn9.value
print spn10.value
print spn33.value
print rdo11.state

yarab= FormGeneration spn7.value spn9.value spn10.value spn33.value rdo11.state
)
)
------------------------------------------------------P1 ends here ----------------------------------------------------------------------

rollout p2 "Clustering" width:289 height:301
(
dropdownList ddl3 "Interpolation Direction" pos:[9,15] width:205 height:40 items:#("Vertical", "Horizontal")
GroupBox grp11 "Vertical " pos:[4,66] width:303 height:94
radiobuttons rdo7 "Organisation" pos:[34,79] width:166 height:30 labels:#("Staggered", "Random") columns:2
spinner spn18 "No. of Stories" pos:[75,121] width:123 height:16 enabled:true range:[0,4,0] type:#integer

GroupBox grp12 "Horizontal" pos:[4,167] width:303 height:102

radiobuttons rdo6 "Organisation" pos:[34,187] width:128 height:46 labels:#("Ribbon", "Puzzle", "Patio", "Grouped") default:1 columns:4
spinner spn19 "No. of Stories" pos:[75,230] width:123 height:16 enabled:true range:[0,4,0] type:#integer

)-----------------------------------------------------P2 ends here------------------------------------------------------------------------


createdialog r1 350 350
addSubrollout r1.EmptySubRollout p1 -- to add the first rollout automatically when open the interface

ZeBoxx2
10-18-2008, 12:25 PM
For any of the non-standard 3ds Max UI elements (and some would say 'all UI elements'), you should look into using .NET controls as later 3ds Max versions no longer support ActiveX controls.
( Not sure how long it will be before everybody is going to have to use SilverLight elements %) )

Do a search in this forum section for "dotnet tab" and/or "tabcontrol"

Here's a nice post from Bobo with sample code that makes it easy to define tab content (as rollouts), and has a snippet of code that automatically turns those rollouts into separate tabs:
http://forums.cgsociety.org/showpost.php?p=4989363&postcount=2

CGTalk Moderation
10-18-2008, 12:25 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.