Copy Properties to custom component?

A forum where Flowcode v6 user created components can be shared, discussed and reviewed.

Moderator: Benj

Post Reply
GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Contact:

Copy Properties to custom component?

Post 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.

kersing
Valued Contributor
Valued Contributor
Posts: 1939
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: Copy Properties to custom component?

Post 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.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
Benj
Matrix Staff
Posts: 14865
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Copy Properties to custom component?

Post 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 172 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.

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Contact:

Re: Copy Properties to custom component?

Post by GTF »

Thanks Benj, I'll have a look at it.

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Contact:

Re: Copy Properties to custom component?

Post 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"

kersing
Valued Contributor
Valued Contributor
Posts: 1939
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Contact:

Re: Copy Properties to custom component?

Post 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.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Contact:

Re: Copy Properties to custom component?

Post 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

Post Reply