codemorphis.com Forum Index codemorphis.com
Software development: pure and simple.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Programming Tip #3: Modifying Component Port Interfaces

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    codemorphis.com Forum Index -> Visual Programming Forum
View previous topic :: View next topic  
Author Message
CodeMorphis



Joined: 02 Dec 2003
Posts: 252

PostPosted: Sat Jan 17, 2004 11:33 am    Post subject: Programming Tip #3: Modifying Component Port Interfaces Reply with quote

Programming Tip #3: Modifying Component Port Interfaces

Each Synopsis component has a port interface that allows you to access its service(s) and/or data values. In the Synopsis Help documentation there are discussions about the two types of port interfaces:


  • Data ports (blue)
  • Process ports (red)

In this article we will take a look at how some components allow you to modify their port interfaces depending on your programming needs.

Let's consider the Add component, available from the "Math" tab in the component tray.



Of particular interest are the input data ports, which are blue and are located at the top of the component. Now as we know, the Add component receives data input from the two data ports and "adds" them together, passing the resulting value to the sole output data port (the blue port at the bottom of the component). The input values of course, can be of any value type, that is, they can be integers, floating point values or even character strings.

Often, one needs to add more than two values together, or in the case of strings, concatenate more than two strings. Rather than use a series of Add components to do the job, we can simply modify the input port interface of the Add component to allow it to accept more than 2 input arguments.

Double click the Add component to bring up the component's property dialog.



Note the value of the "Number of add arguments" property, which is by default 2. Let's change this value to 4, for example. When we click on the OK button in the property dialog, the port interface of the component changes. Specifically, it now has 4 input data ports as opposed to 2:



We can now specify 4 input arguments for the add service. The Add component allows for between 2 and 16 arguments.

Some other components that allow you to modify the port interface include:


  • The Console Print component (I/O tab of the component tray)
  • The Switch component (Logic tab)
  • The Set Variable component (Data tab)
  • The Variable component (Data tab)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    codemorphis.com Forum Index -> Visual Programming Forum All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group