Custom Properties in Separate Source

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Mark Smart
Profound User
Posts: 22
Joined: Tue Apr 14, 2015 9:30 am
First Name: Mark
Last Name: Smart
Company Name: Anker International
Contact:

Custom Properties in Separate Source

Post by Mark Smart »

Hello all,

Is it possible to put source for custom property in a separate file if the property affects multiple controls?
I'm creating a number of new custom css Button widgets and they all need a response property.
Initially, I was including the addCustomProperty call, for the new response property, in the source for each widget, specific to that widget, as below.

Code: Select all

[b]cssBackButton.js[/b]
pui.addCustomProperty({
	name: "response",
	type: "long",
	controls: ["css back button"],
	category: "Identification",
	help: "Specifies a response indicator that is returned to your program when the element is clicked.",
});

[b]cssExitButton.js[/b]
pui.addCustomProperty({
	name: "response",
	type: "long",
	controls: ["css exit button"],
	category: "Identification",
	help: "Specifies a response indicator that is returned to your program when the element is clicked.",
});

[b]cssPauseButton.js[/b]
pui.addCustomProperty({
	name: "response",
	type: "long",
	controls: ["css pause button"],
	category: "Identification",
	help: "Specifies a response indicator that is returned to your program when the element is clicked.",
});

In designer, both controls had the response property available to them, as specified in the pui.widgets.add defaults{}, but when saving the screen, the DDS only had one of the bound fields.

I eventually realised that the response property only needed specifying in the source for one of the 3 widgets, leading to my question; as multiple controls require this property, can the call to addCustomProperty be stored in its own .js source file which will automatically be consumed by designer and applied across all controls that need it?
Am I using the correct methods/techniques or is there a better technique for doing this kind of thing?

Code: Select all

[b]cssExitButton.js[/b]
pui.addCustomProperty({
	name: "response",
	type: "long",
	controls: ["css back button", "css exit button", "css pause button"],
	category: "Identification",
	help: "Specifies a response indicator that is returned to your program when the element is clicked.",
});
Any help appreciated.

Regards,

Mark
Scott Wagers

Re: Custom Properties in Separate Source

Post by Scott Wagers »

Mark,

To answer your question yes, the call to addCustomProperty be stored in its own .js source file which will automatically be picked up by designer and applied across all controls specified in the API.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests