Home Technical Talk

Max script - rollout expand/collapse callbacks?

Warheart
polycounter lvl 17
Offline / Send Message
Warheart polycounter lvl 17
I'm wondering if anyone might be able to help me with a little bit of useful functionality I'd like to build into a set of Max Script tools I'm working on at the moment. I have a fair bit of experience with Maya/MEL but I've recently switched to Max so forgive me if any of my terminology is wrong.

What I'd like to do is have my floating interface window resize automatically to fit its contents when a subrollout is expanded/collapsed by the user. Obviously the resizing part is easy but what I've struggled to find is whether there is a callback I can use to execute a bit of script when a subrollout is expanded/collapsed.

I have tried using something like this:

on mySubrollout.open changed val do
(
if (mySubrollout.open == true) then myUIwindow.height += 150
else myUIwindow.height -= 150
)

but "changed val" seems to only be set up to look for changes in script created variables as far as I can see.

If anyone knows of a specific callback for rollout expand/collapsed this that would be ideal or if you have any ideas for another way of doing it that would be useful too.

Thanks.

Replies

  • SyncViewS
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi, here is an example to toy with:
    rollout rolMain "Test"
    (
        subRollout scriptBin width:100 height:200 pos:[-1,-1]
    
    --------------------------------------------------------------------------------
    
        rollout rolSub_1 "rol_1"
        (
            label lb_01 "rolSub_1"
        
            on rolSub_1 rolledUp bState do
            (
                if (bState == true) then
                (
                    rolMain.height += rolSub_1.height
                    rolMain.height += 4
                )
                else
                (
                    rolMain.height -= rolSub_1.height
                    rolMain.height -= 4
                )
            )
        )
        
        rollout rolSub_2 "rol_2"
        (
            label lb_01 "rolSub_2"
        
            on rolSub_2 rolledUp bState do
            (
                if (bState == true) then
                (
                    rolMain.height += rolSub_2.height
                    rolMain.height += 2
                )
                else
                (
                    rolMain.height -= rolSub_2.height
                    rolMain.height -= 2
                )
            )
        )
    
    --------------------------------------------------------------------------------
    
        on rolMain open do
        (
            addSubRollout scriptBin rolSub_1
            addSubRollout scriptBin rolSub_2
        )
    )
    
    createDialog rolMain 94 103
    
  • Warheart
    Offline / Send Message
    Warheart polycounter lvl 17
    Thanks a lot, SyncViewS. Great elegant example. That's exactly the stuff I was looking for. Thanks again.
  • SpencerT
    Exactly what I needed too! Thanks a lot.

    - Spencer
Sign In or Register to comment.