Notifications
Clear all

[Closed] Create rollouts inside functions or not

in this case this is the structure (instance of this structure) where the rollout was defined.
look at this sample:


struct test
(
	param = 0,
	name = "Button",
	rolloutname = "Rollout",
	rol = 
	(
		rollout rol this.rolloutname
		(
			button bt this.name
			on rol open do format ">> % %
" this this.param 
		)
	),
	on create do createdialog rol
)
test param:2

using this we can get access to all structure’s properties, and can use them for the rollout creation.

2 Replies
(@alexanderh)
Joined: 11 months ago

Posts: 0

Maybe I am missing something, but I get this when I run that sample:

-- Error occurred in anonymous codeblock; filename: C:\Users\ahosking\Dropbox\3DS Max Development\UI\; position: 143; line: 10 
-- Syntax error: at ., expected name 
-- In line: button bt this.n
(@alexanderh)
Joined: 11 months ago

Posts: 0

Turns out that a simple definition change in Max 2011 is required to fix this.

button bt this.name

becomes

button bt text:this.name

the same meaning of this is for scripted plugins (all kind), custom attributes, and structures…
also you can use this in scripted controller expression, which means this controller itself.

Thanks to this thread (and the wonderful generosity of the members of this forum with their knowledge and time) I’m currently re-forming my whole script system into a new structure based one. I have the main structure, inside which there are all the various rollouts as well as an additional structure which has all of the functions that are used amongst the various rollouts. Of course, they can all talk to each other’s UI elements and any functions I were to define within each rollout anyway, but this way it’s a bit neater.

It’s taken some time getting my head around it, but it’s nice now that it is! Since I’m doing such a significant rejig, I’m also taking the time to have multiple rollouts within a single dialog, which makes the UI a bit nicer, too.

Page 2 / 2