SDK :: How can I know that rollut is open?


#1

I accidentally found that I can’t tell if a particular Rollout is currently rolled up or not (open or closed) via the SDK.
I can tell it when the Rollout is in a Rollout Floater…
Or I can check Command Panel as IRollupWindow and find my rollout…

But I can’t check the open/closed state using only rollout’s properties, flags, or methods.

Did I miss anything? :face_with_raised_eyebrow:


#2

does this not work ?

IRollupWindow::IsPanelOpen ( int index )


#3

Yes, as I said above, it works. But You have to get IRollupWindow which is different every time and depends on Command mode…
I try to get #open state from Rollout side


#4

MXS Rollout has #open property…
it doesn’t always work right, but at least they try to give it some meaning. Why? How? Where does this state come from?


#5

so what’s the class you’re starting from ?


#6

it is handled inside maxscrpt.dll in rollout::get_property
%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5
.


#7

I assumed some kind of dirty trick of this kind - a certain flag in the body of the code … by the way, as I said, this is not always true


#8

ok… I found it:

def_visible_primitive(isRolloutOpen, "isRolloutOpen");
Value* isRolloutOpen_cf(Value** arg_list, int count)
{
	check_arg_count_with_keys(isRolloutOpen, 1, count);
	auto val = arg_list[0];
	if is_rollout(val)
	{
		return bool_value(IsRollupPanelOpen(((Rollout*)val)->page));
	}
	return_undefined;
}

#9

… but it’s still not exactly what I’m looking for.
I’ll try to make a snippet to show the problem… but it’s too late for today :wink:


#10
ui_ca = attributes ui_ca attribid:#(0xee11, 0x11ee)
(
	parameters controls rollout:controls
	(
	)
	rollout controls "Controls" rolledup:off --autoLayoutOnResize:off --category:10 
	(
		group "Data: "
		(
			button one_bt "One" width:136 align:#left offset:[0,0]
			button two_bt "Two" width:136 align:#right offset:[0,0]
		)
		
		on controls rolledup val do
		(
			format "controls >> ROLL ... val:%\t open:%\n" val controls.open
		)
		on controls open do
		(
			format "controls >> OPEN ... val:%\t\t open:%\n" ok controls.open
		)
	)
	rollout settings "Settings" rolledup:on --autoLayoutOnResize:off --category:11 
	(
		group "Info: "
		(
			button this_bt "This" width:66 align:#left offset:[0,0] across:2
			button that_bt "That" width:66 align:#right offset:[0,0]
		)
		on settings rolledup val do
		(
			format "settings >> ROLL ... val:%\t open:%\n" val  settings.open
		)
		on settings open do
		(
			format "settings >> OPEN ... val:%\t\t open:%\n" ok  settings.open
		)		
	)
)

undo off, redraw off
(
	--try(deletereference (getclassinstances ui_ca)) catch()
	suspendediting()

	max create mode

	delete objects
	gc()

	p = point name:#test isselected:on
	custattributes.add p ui_ca

	max modify mode

	resumeediting()
)

This snippet demonstrates the issue… more specifically - incorrect UI resizing with 4K monitors, or with UI scaling factor not 1.0.
I don’t want to resize at all! I want to keep both rollouts in the original design.
If someone can do this please show me how.
What I have, when I close/open rollouts, change the command panel, select/deselect the node, the UI gets messed up in some situations.

Also, if you check the print in the listener, you’ll see that sometimes it says the rollout is open when it’s actually closed, and says it’s closed when it’s open.