Jul 20 2011

converting activeX tabs to dotNet tabs in maxScript (repost)

This is an other repost from an old blog.. i figure i transfer it over 🙂

Ok, so i started updating some scripts that I’ve used tabs for, this is what i have found so far.

the dot net controller syntax for tabs is..

dotNetControl axList "System.Windows.Forms.Tabcontrol"

this makes a tab controller with the variable name of axList
the previous activeX controller would make the tab group and give you one default tab, this is not the same for dotNet tabs. in dotNet Tabs you have to create each tab your self.

adding new tabs is very easy, here’s the syntax to add tabs….

Tab = axList.tabPages.add "myAwsomeTab"

tab information can be access through “tabPages”, for example to query how many tabs there are in the tab controller you can do this…

numberOfTabs = axList.tabPages.count

to query individual tabs you have to use add “.Item” and then the index of the node you want to acess, (keep in mind that dot net controller arrays start at 0 and not at 1 like activeX and maxscript arrays)

firstTab = axList.tapPages.item[0]

this will store the first tab in the tab controller to in the variable first Tab.

if you need to query the or change the selected node there are now two methods to do this

selectedIndex = axlist.selectedIndex
selectedTab = axlist.selectedTab

the last thing i found out is some simple way of changing the appearance of your tabs.

tabStyle = dotNetClass  "System.Windows.Forms.TabAppearance"

this give you a dot net class from which you can apply 1 of the the following 3 styles


this is how you apply the flatButtons style to your tab controller.

tabStyle = dotNetClass  "System.Windows.Forms.TabAppearance"
axlist.Appearance = apClass.flatButtons

this is what I’ve run into today, i don’t like how the tab’s are highlighted by default when selected i don’t think it is obvious enough. i will play around and see if a can find some good methods of changing that, i might play around with changing the color of selected nodes or something until then, good luck and good night.



4 Responses to “converting activeX tabs to dotNet tabs in maxScript (repost)”

  • Jeff Lim Says:

    Hi Carlos! Thanks for these! Very useful indeed!
    I just noticed that the last few codes you have for changing the Appearance property did not work on my tests.

    But here’s a fix:
    tabStyle = dotNetClass “System.Windows.Forms.TabAppearance”
    axlist.Appearance = tabStyle.flatButtons

    I just replaced “apClass” with the “tabStyle” you defined.

    Although the appearances turned out to be mostly almost the same.. I will be sticking to the defaults for now 🙂

  • john martini Says:

    Do you have any working samples of tabs that i could check out?

Leave a Reply