1
votes

Apologies for the kind-of unrelated questions in one, but I would like to make my MaxScript rollout/tool more intuitive by making it behave like any other GUI would be expected to.

Could anyone familiar with MaxScript tell me:

  1. How do I 'disable' (grey out) a button?

  2. How do I get the Enter key pressed event? (I.e. I have an EditText control. When enter is pressed anywhere in this form I would like to close the dialog (it is not a multiline control))

  3. How do I give focus to a control? (I.e. I would like my rollout opened with CreateDialog to give focus to the EditText control so the user can start typing immediately)

3

3 Answers

2
votes

the first one would be setting its .enabled property to false. The second one depends on the type of control you are using, if it's the usual rollout control, just use on editTextName entered do ... event handler. For a dotnet one you'd have to use

    on editTextName KeyUp evnt do
        if evnt.KeyCode == (dotNetClass "System.Windows.Forms.Keys").Enter do ...

As for the third one, use setFocus method in your rollout open event handler:

    on myRollout open do setFocus editTextName

Hope this is what you were looking for.

0
votes
mybutton.enabled = false

or

mybutton.enabled = off

since off is an alias for false

-1
votes

1.How do I 'disable' (grey out) a button?

Where you add a button or another component to the floater you add enabled:false as method just like height:buttonheight sample: button btnviewdistline "View distance line" width:btnWidth height:btnHeight enabled:false