Page 1 of 1

Custom Layout

Posted: Wed Apr 05, 2017 1:39 am
by HGRobert
I'm very grateful that 5.8 allows us to create a Custom Layout, this offers the possiblility of responsive design with corporate identity within seconds!
I do have questions though, is there something like "propertySetters" (as in pui.widget.add) to execute a piece of JavaScript when a layout property value was changed?

Thanks,

Robert

Re: Custom Layout

Posted: Wed Apr 05, 2017 5:51 pm
by Scott Klement
There isn't something like propertySetters -- that is for when you create a widget. In this case, you are using an existing (Layout) widget.

But, it is possible for JavaScript code to run when the template is evaluated. Take a look at the options for "JavaScript expression variables" documented here:
http://www.profoundlogic.com/docs/pages ... d=31260909

Re: Custom Layout

Posted: Thu Apr 06, 2017 3:54 am
by HGRobert
I developed my CustomLayout after reading the documentation for "pui.retrieveCustomLayoutTemplate( name )"
This is really a great new feature, but I got stuck...

"Properties can potentially be bound to host variables" - How? -> my new properties don't have this option
I also found (when I made a mistake in coding) that the property category can be add... - How to do this properly?

In my new Panel layout there are header sections (like a window control box) that execute a script. In this script I'd like to set a host variable for the specific function...

Re: Custom Layout

Posted: Thu Jun 08, 2017 3:27 am
by HGRobert
In a CustomLayoutTemplate I do have the following part:

<div class="content"><div repeat="{ property: 'Number of Divs', help: 'Text, text, text...' }" class="tab" container="true">......-X-......</div></div>

At ......-X-...... I'd like to add an array item, i.e. a paragraph to fill the corresponding div.
How can I access that particular item? In other words, is there somthing like an index variable when using "repeat"?

Any help is greatly appreciated,

Robert

Re: Custom Layout

Posted: Thu Jun 08, 2017 5:07 am
by Scott Klement
Sorry, there isn't any way to use an array for this.

Re: Custom Layout

Posted: Thu Jun 08, 2017 10:45 am
by HGRobert
Thanks for the quick answer Scott.

I just can't let off... Is there a way to use containers in custom widgets?

Re: Custom Layout

Posted: Thu Jun 08, 2017 12:00 pm
by Scott Klement
If you mean "custom layouts", yes... you should be able to use containers.

If you mean other types of widgets, then no... only a layout can be a container.