Customising A Component

From Flowcode Help
Jump to navigationJump to search

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 your favourite panel. I am using the LCD which I want to assign with custom pre-set pins on PortD.

CAC1.jpg


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.

CAC2.jpg


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.

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.

CAC4.jpg


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.

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.

CAC6.jpg


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 -> Component Configuration menu.


Setup Tab - Standard

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

CAC7.jpg


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


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

Components location : "C:\ProgramData\MatrixTSL\FlowcodeV8\Components"

Export directly into the Components folder by copying and pasting the path into the filename field and hitting return.


Custom Location

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.

CAC8.jpg


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.

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.