Page 1 of 1

Copy Properties to custom component?

Posted: Tue Jun 14, 2016 5:36 pm
by GTF
Hi,
First attempt at putting together a custom component. This one includes the cal_SPI component. I have copied the properties of the SPI component to the custom component's properties. The problem is that when the custom component is used in a project, and "Channel 1"(hardware SPI) is selected, the SPI pins do not map to the correct pins for the target device. Each pin must alwways be manually configured, no matter whether "Channel 1" or "Software" is selected.

Re: Copy Properties to custom component?

Posted: Tue Jun 14, 2016 6:05 pm
by kersing
You will need to implement an event handler for the property change event. Every time it fires you need to copy your settings to the underlying component and then read back the appropriate values for 'static' settings like hardware pins for hardware SPI. (Which means you need to decide which properties are 'static' when selecting a certain value.)

There is a feature request to allow properties to be inherited to avoid this kind of duplication.

Re: Copy Properties to custom component?

Posted: Wed Jun 15, 2016 10:50 am
by Benj
Hello,

This is an example of how we do hardware component connections for SPI including hardware, software and remappable modes.
SPI_CopyProps.fcfx
(30.33 KiB) Downloaded 386 times
We wanted the property inheritance to be included in v7 but so far we have not managed to get round to it. Hopefully it is something we can do for 7.1 as it would drastically simplify things like this.

Re: Copy Properties to custom component?

Posted: Wed Jun 15, 2016 5:06 pm
by GTF
Thanks Benj, I'll have a look at it.

Re: Copy Properties to custom component?

Posted: Sat Jun 18, 2016 4:24 pm
by GTF
Is there a list of valid events? From where is a macro such as Ev_Property called?

Seems to be something in the example that I cannot see that allows it to work while the same code ported to my component doesn't. Importing my code to the example works, but I am not allowed to view the generated code?? "You do not have a valid license to perform this action"

Re: Copy Properties to custom component?

Posted: Sat Jun 18, 2016 7:08 pm
by kersing
GTF wrote:Is there a list of valid events?
Check the documentation @ the website...
GTF wrote:From where is a macro such as Ev_Property called?
At the top of the project explorer there is an icon with "EV", once you open that list you will see the list of events. Attach the macro to a event by double clicking the event (in this case "Components"->"Property") and selecting the macro from the list at the top. If your macro is not compatible (second list) create a new macro by double clicking on the word 'Macro' and copy the contents of the existing macro to the new macro.

The on-line help pages contain more information on events with video instructions.
GTF wrote:Importing my code to the example works, but I am not allowed to view the generated code?? "You do not have a valid license to perform this action"
You can not export components with the same identifier used for genuine Matrix components. Only Matrix can export those components.

Re: Copy Properties to custom component?

Posted: Mon Jun 20, 2016 4:10 am
by GTF
kersing wrote:At the top of the project explorer there is an icon with "EV"
Guess I couldn't see that for looking!

Got it all sorted out and working now.

Thanks kersing!

Grant