Jump to content

Customising A Component: Difference between revisions

From Flowcode Help
No edit summary
 
(11 intermediate revisions by 4 users not shown)
Line 2: Line 2:


Sometimes components may need to be customised, for example with specific default pin connections that are meaningful for your hardware.
Sometimes components may need to be customised, for example with specific default pin connections that are meaningful for your hardware.
Note: Anything on the panels in your project will be exported inside the new component so make sure you start with a clean project.




Line 10: Line 8:
Begin by starting a new project and select the microcontroller you are going to be using.
Begin by starting a new project and select the microcontroller you are going to be using.


Next add the component you wish to customise to your favourite panel. I am using the LCD which I want to assign with custom pre-set pins on PortD.
Next add the component you wish to customise to the apropreate panel e.g 2D for 2D components. I am using the generic customable LCD which I want to assign with custom pre-set pins on PortD.
 
[[File:CAC1.jpg]]




Line 16: Line 16:


Select the component on the panel and open the Properties window. Then adjust the properties to be as you want them to be. For example I'm going to change the pins from the default PortB 0-5 to PortD 2 - 7.
Select the component on the panel and open the Properties window. Then adjust the properties to be as you want them to be. For example I'm going to change the pins from the default PortB 0-5 to PortD 2 - 7.
Tip: You can change the top pin then Right or left click and select '''Auto connect digital'''
[[File:CAC2.jpg]]




==Exposing Properties==
==Exposing Properties==


While we are in the properties window there may be properties that you will still need to be available to the user when using your new customised component. Simply right click these properties and choose Expose from the menu to expose these properties to the user of the component. You can see which properties will be available to the user by clicking on a blank area of the component panel, or by choosing Panel from the drop down menu at the top of the Properties window.
While we are in the properties window there may be properties that you will still need to be available to the user when using your new customised component. Simply right click these properties and choose Expose from the menu to expose these properties to the user of the component.  
 
[[File:CAC3.jpg]]
 
You can see which properties will be available to the user by clicking on a blank area of the component panel, or by choosing Panel from the drop down menu at the top of the Properties window.
 
[[File:CAC4.jpg]]




==Exposing Macros==
==Exposing Macros==


As well as properties you will also need to expose the macros for the component that can be called. This could be all the components macros or could simply be a sub set if you only ever use a few macro calls from a component. Open the Project Explorer window and select the components tab, then right click any macros you want available and select Expose from the menu. You can see which macros will be available to the user by clicking on a blank area of the component panel, or by choosing Panel from the drop down menu at the top of the Properties window and then selecting the Macros tab.
As well as properties you will also need to expose the macros for the component that can be called. This could be all the components macros or could simply be a sub set if you only ever use a few macro calls from a component. Open the Project Explorer window and select the components tab, then right click any macros you want available and select Expose from the menu.  
 
[[File:CAC5.jpg]]
 
You can see which macros will be available to the user by clicking on a blank area of the component panel, or by choosing Panel from the drop down menu at the top of the Properties window and then selecting the Macros tab.
 
[[File:CAC6.jpg]]




==Finishing Up==
==Finishing Up==


Before we export the component we need to do a number of small finishing steps to get the new component ready. First save your project with a meaningful name so you can go back and re-export the modified component in future.
Before we export the component we need to do a number of small finishing steps to get the new component ready. First save your project in a meaningful location with a meaningful name so you can go back and re-export the modified component in future if needed.


Next click on the File -> Component Configuration menu.
 
Next click on the '''File''' -> '''Export''' -> '''Edit the export settings for your component'''




===Setup Tab - Standard===
===Setup Tab - Standard===


Give the component a Name, a Cosmetic Name, Assign a Category from the drop down menu.
Give the component a Name, a Cosmetic Name, Assign pannel type, Assign a Category from the drop down menu.
 
[[File:CAC7.jpg]]




Line 50: Line 69:
==Exporting the component==
==Exporting the component==


Next simply click File -> Export to save the component as a .fcpx file. This file can be saved into the standard Flowcode components folder or you can create your own folder.
Next simply click the '''File''' -> '''Export''' -> '''Export this project as a component''' to save the component as a .fcpx file. This file can be saved into the standard Flowcode components folder or you can create your own custom folder.
 
You might be prompted to save the project fcfx file first if there have been any changes.




Line 60: Line 81:




===Flowcode 8===  
===Flowcode 8 and later===  
 
It is recommended that user-generated components are saved into a [[Customising_A_Component#Custom_Location|custom location]] and not saved to Flowcode's component folder. This is because Flowcode may modify its component folder following an update and any components saved there may be deleted.
 
Since v11.0.2, Flowcode will warn you if you attempt to export a component into this area of %PROGRAMFILES%.
 
However, it is still possibly to save your own components there. But make sure you have a back-up.
 
Flowcode's components folder for versions v8 and older can be found in the following location : "%PROGRAMDATA%\MatrixTSL\FlowcodeVxx\Components", where "xx" is the version of Flowcode.


Components location : "C:\ProgramData\MatrixTSL\FlowcodeV8\Components"
%PROGRAMDATA% is a reference to a common location used by Windows-based apps.  Typically this will be "C:\ProgramData\" but may be elsewhere if the OS is installed on a different drive or is in a non-English language.


Export directly into the Components folder by copying and pasting the path into the filename field and hitting return.
So for v11, the components location is typically: "C:\ProgramData\MatrixTSL\FlowcodeV11\Components".




Line 71: Line 100:
Export directly to your own custom components folder.
Export directly to your own custom components folder.


To use your own folder simply click on the View -> Global Options -> Locations Tab menu and add your custom folder location to the Look for components in... text field.
To use your own folder simply click on '''File''' -> Global Settings -> Locations Tab menu and add your custom folder location to the Look for components in... text field.


[[File:CAC8.jpg]]


==Using the component==
==Using the component==


The new component should now appear in Flowcode in the category you selected. Simply use the component as you would any other component.
The new component should now appear in Flowcode in the category you selected. Simply use the component as you would any other component.
[[File:CAC9.jpg]]
==Advanced - Dynamic Properties==
Note: Some component properties such as CAL type component channels and pins are dynamic and based on the selected target microcontroller and will not work with the method explained above, for these you will have to use something like the Initialise event and the Simulation API to force your custom property values in as the component is loaded.

Latest revision as of 11:47, 29 June 2026

Introduction

Sometimes components may need to be customised, for example with specific default pin connections that are meaningful for your hardware.


Adding the component

Begin by starting a new project and select the microcontroller you are going to be using.

Next add the component you wish to customise to the apropreate panel e.g 2D for 2D components. I am using the generic customable LCD which I want to assign with custom pre-set pins on PortD.


Presetting Property Values

Select the component on the panel and open the Properties window. Then adjust the properties to be as you want them to be. For example I'm going to change the pins from the default PortB 0-5 to PortD 2 - 7.

Tip: You can change the top pin then Right or left click and select Auto connect digital


Exposing Properties

While we are in the properties window there may be properties that you will still need to be available to the user when using your new customised component. Simply right click these properties and choose Expose from the menu to expose these properties to the user of the component.

You can see which properties will be available to the user by clicking on a blank area of the component panel, or by choosing Panel from the drop down menu at the top of the Properties window.


Exposing Macros

As well as properties you will also need to expose the macros for the component that can be called. This could be all the components macros or could simply be a sub set if you only ever use a few macro calls from a component. Open the Project Explorer window and select the components tab, then right click any macros you want available and select Expose from the menu.

You can see which macros will be available to the user by clicking on a blank area of the component panel, or by choosing Panel from the drop down menu at the top of the Properties window and then selecting the Macros tab.


Finishing Up

Before we export the component we need to do a number of small finishing steps to get the new component ready. First save your project in a meaningful location with a meaningful name so you can go back and re-export the modified component in future if needed.


Next click on the File -> Export -> Edit the export settings for your component


Setup Tab - Standard

Give the component a Name, a Cosmetic Name, Assign pannel type, Assign a Category from the drop down menu.


Setup Tab - Advanced

If you have already created one component from your project file and want to create a new but different component then click Edit next to GUID and click New next to the GUID, this ensures you do not overwrite your previously exported component.


When you're done click OK.


Exporting the component

Next simply click the File -> Export -> Export this project as a component to save the component as a .fcpx file. This file can be saved into the standard Flowcode components folder or you can create your own custom folder.

You might be prompted to save the project fcfx file first if there have been any changes.


Flowcode 7

Components location : "C:\Program Files (x86)\Flowcode 7\Components"

Export somewhere with write access e.g. your desktop and then manually copy the file into the components folder using Windows explorer, you will need administrator permissions to write inside the Program Files (x86) folder.


Flowcode 8 and later

It is recommended that user-generated components are saved into a custom location and not saved to Flowcode's component folder. This is because Flowcode may modify its component folder following an update and any components saved there may be deleted.

Since v11.0.2, Flowcode will warn you if you attempt to export a component into this area of %PROGRAMFILES%.

However, it is still possibly to save your own components there. But make sure you have a back-up.

Flowcode's components folder for versions v8 and older can be found in the following location : "%PROGRAMDATA%\MatrixTSL\FlowcodeVxx\Components", where "xx" is the version of Flowcode.

%PROGRAMDATA% is a reference to a common location used by Windows-based apps. Typically this will be "C:\ProgramData\" but may be elsewhere if the OS is installed on a different drive or is in a non-English language.

So for v11, the components location is typically: "C:\ProgramData\MatrixTSL\FlowcodeV11\Components".


Custom Location

Export directly to your own custom components folder.

To use your own folder simply click on File -> Global Settings -> Locations Tab menu and add your custom folder location to the Look for components in... text field.

Using the component

The new component should now appear in Flowcode in the category you selected. Simply use the component as you would any other component.


Advanced - Dynamic Properties

Note: Some component properties such as CAL type component channels and pins are dynamic and based on the selected target microcontroller and will not work with the method explained above, for these you will have to use something like the Initialise event and the Simulation API to force your custom property values in as the component is loaded.