gui help

I want to create a GUI that is basically a ton of buttons with different images, where each button runs a command who's name is based on the names of other scripts i have.

First, I don't know how to house all the buttons on a grid so that there is a scroll bar if need be.

Second, I want the buttons to be created depending on the files in my script folder. Each button will run a script in my script folder.

In summary, the buttons need to be generated, but I don't know how to procedurally create buttons, their names, and what they do (even though all that info is given by the title of the files in the script folder.)


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

buttons are not solution for

buttons are not solution for that.
better try to use listbox, listview, or dopdown list.


roosterMAP's picture

ok, i figured it out. now I

ok, i figured it out.

now I want to run commands i'v loaded in as strings.

for example:

myFiles[nameIndex] = "ringBolt()"

I want to run the command ringBolt()

barigazy's picture


execute "ringBolt()"


roosterMAP's picture

strange, it didn't do what i

strange, it didn't do what i expected.

Basically, I have converted a bunch of greebles into plugins using that primitive maker script. (
I want to make a GUI that will let me browse through my primitives quickly. So i now have a listbox that automatically loads in all my plugins and when I select one, it spawns a primitive at the origin.
At the top of the GUI, an image of the currently selected greeble is displayed.

What I want it to do is make it exactly like when you click on one of "create primitive" buttons... where u can create and re-size a primitive when u click in a viewport.

So I guess my question is, whats the difference between running Box() in the listener, and actually clicking the button? and how can I replicate the button click in a listbox?

barigazy's picture

Use this line [your plugin class]


StartObjectCreation Box
StartObjectCreation Line
StartObjectCreation Teapot


roosterMAP's picture

Kinda back to the last

Kinda back to the last problem tho.
I keep getting this error: --Runtime error:startObjectCreation() requires a scene object class parameter, got "eyeBolt04"

Since it thinks eyeBolt04 is a string, it doesn't know what to do.
I tried it in the listener, and it works perfectly if I type in:
StartObjectCreation eyeBolt04

I just need to convert the string "eyeBolt04" into the command eyeBolt04.

Then my script will be finished!

MKlejnowski's picture

Try this

Try doing what you did before with execute "ringBolt()" except create a new string with the StartObjectCreation

--Provided myFiles[nameIndex] is the string
Execute ("StartObjectCreation " + myFiles[nameIndex])

Or you could also use

StartObjectCreation (readvalue ("eyeBolt" as stringstream))

Also make sure its the classof of the object and nt th nam as barigazy has stated.

roosterMAP's picture

thx! it works perfectly!

thx! it works perfectly!

roosterMAP's picture

new problem. lol I am trying

new problem. lol

I am trying to update a bitmap everytime I click on an option in the listbox.

Here's what I tried, but it doesn't work. Any ideas?

Global String displayImage = "C:\Program Files\Autodesk\3ds Max 2011\plugins\greebles\images\blank.jpg"
bitmap templateBmp fileName: displayImage

--on testbox selection do:
displayImage = "C:\Program Files\Autodesk\3ds Max 2011\plugins\greebles\images\\" + finalString + ".jpg"
reload templateBmp

--finalString is the name of the image selected in the listbox

MKlejnowski's picture

Are you trying to get

Are you trying to get something to change every time you change the selection of the listbox?

Are we talking about a Bitmap UI controller or are you referring to a simple bitmap?

Also doesn't hurt to throw up your actually code with to get and idea of what you are doing wrong and what could be done better.

I normally create a function with in the rollout called UpdateUI and just have the function run with each event handler to keep copies of code to a minimum. Also help in keeping debugging to a minimum if I only need to fix it in one place.

fn UpdateUI =
   --have all my code which affects the presentation of the ui go here

and then when i run an event handler for one of my controllers i always add the funtion to be executed last

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.