Simple switch edit

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
darrynenig22
Posts: 11
Joined: Mon Oct 06, 2014 12:55 pm
Location: Somerset, UK
Been thanked: 1 time
Contact:

Simple switch edit

Post by darrynenig22 »

Hi
When using Flowcode V5 it was so very easy to place two custom images for OFF / MID / ON

Placed on the dashboard panel static picture ON when pressed is replaced with static picture OFF

I have been trying to edit the base switch in V8 and V9 to create a new component and modify to replicate this very simple button press.
Have found it very difficult to navigate through the GUI and the exposed component folders to get this.

Can you provide a working example so I can see how it was created.


Thanks
Attachments
OFF.png
OFF.png (13.1 KiB) Viewed 2307 times
ON.png
ON.png (12.62 KiB) Viewed 2307 times
Switch 2png_ON-OFF.fcfx
(7.03 KiB) Downloaded 151 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Simple switch edit

Post by Benj »

Hello,

I've made a simple example for you here which should do just about everything you need.
SwitchDemo.zip
(31.83 KiB) Downloaded 193 times
I've also started a bit of a write up here.
https://www.flowcode.co.uk/wiki/index.p ... mpleSwitch

Let me know how you get on.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Simple switch edit

Post by Benj »

Sorry spotted a bug in the Ev_Release macro.

Should be this.
bug.jpg
bug.jpg (44.75 KiB) Viewed 2263 times
Also another in GetSwitchState macro.
bug2.jpg
bug2.jpg (25.01 KiB) Viewed 2263 times

darrynenig22
Posts: 11
Joined: Mon Oct 06, 2014 12:55 pm
Location: Somerset, UK
Been thanked: 1 time
Contact:

Re: Simple switch edit

Post by darrynenig22 »

Hi Benj,

Thanks for the demo file, Im beginning to understand the structure of component creation, structure and saving created components.

The switchdemo file was very helpful.

There is an issue when I add multiple instances of the newly created component from the component library to the panel and assign separate ports to each off the switches they work as expected,but all switches retain there previous states if pressed in when flowcode is run again.
I have tried to follow what the handle SW_Object is interacting with but need some help .


Cheers Darryn
Attachments
SwitchDemo2.zip
(40.09 KiB) Downloaded 168 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Simple switch edit

Post by Benj »

Hello,

If you wish to reset the switch state then create an event macro for the Simulation start event using the Events tab of the project explorer.

Inside the macro use a calculation to set the following code and that should reset the state on run.

Sw_Pin = State

Post Reply