Misc questions and answers

Recommended Posts

We received an email with a host of good questions from a new user I thought we should share on the forum.  The answers are a little terse to allow you to explore.  Feel free to ask follow-ups:

How do I change the default text color?  When working on a black background it’s hard to find black text.

You can't.  That's why (among other reasons) I don't use black backgrounds.  The best workaround is to create a formatted component, then duplicate or copy/paste it.  Or, you can always create a user component out of it, then it will show up in the component popup (at the bottom).  Usually this is used for groups of components, but there is no reason you couldn't do it for a single component. 
How do I format numbers in order to get a “,” thousands (comma) separator displayed?
Use the Format() function. 
Can a variable value component display numeric data this is right justified?  I want to display numeric data in aligned columns.
Yes, open the Properties docking window (View - Properties).  This gives you access to many of the component's properties.  There is one called Align that only appears here.  Set it to 1 for left, 2 for center, 3 for right, and 0 for auto-size left.  Note that when it is not 0, you have to set the size. 
I’ve figured out the grid but I can’t find a display that tells me the size in pixels and coordinate location of objects.  Example; SF pipe and fittings don’t align and scale precisely before grouping, etc.
Again, use the properties docking window.  It will show you these numbers and let you change them. 
How do you get a pipe network (group of SF pipe and fittings?) to animate or change color as a group?
You can group the components, but you still have to change the colors manually in each control. I suppose you could name all the components the same thing, then in script change the color.  That would work too.
Can grouped components be scaled?
You mean resized?  Yes, if you find the group in the Workspace under the appropriate page, you can select a grouped component without ungrouping and then resize it.   
What is the most efficient way to create channel controlled, multi-colored symbol components (5 state pump, 3 state tank, etc.)?
Use symbols with different color symbols as actual different images.  Again, either duplicate the final component or use the user component feature to make a template so you can reuse. 
How do I create a HOA radio button (auto, off, hand from top to bottom); AUTO would set Modbus 201 high & 202 low, OFF would set both 201 & 202 low, HAND would set 201 low & 202 high?
You would have to use a quick sequence action.  First, let's say you have two channels called mod201 and mod202.  I would of course use better names, but you get the point.  The Expression for the symbol component would be: mod201[0] * 2 + mod202[0].  That way you get 0 for OFF, 2 for AUTO and 1 for HAND.  Then set a quick sequence action for the component.  The script would be something like this:
private curState = mod201[0] * 2 + mod202[0]
   case(curState == 0) // currently off
      mod202 = 1 // go to hand
   case (curState == 1) // currently hand
      mod201 = 1
      mod202 = 0
   case (curState == 2) // currently auto
      mod201 = 0
      mod202 = 0
Can a radio button display button and/or text color based on selection or address?
Not sure what you mean.  Remember you don't have to use the text on the radio button.  You can always use static or variable value components to provide the radio labels. 
Can the vertical spacing on a radio button be modified?
No.  You would have to create your own radio type control using a combination of components.
I created a symbol (background topo map) in SF but it locks up DAQF when I copy and paste it to a page using the WMF option:.  Is there an alternative method to import large BMP or WMF files as backgrounds (typically maps)?
Under the latest (18.1), which you should probably use, there is a Load image button in the symbol component that allows you to load PNG / GIF files directly into the control.  You also don't have to put images into Symbol Factory to use them.  You should only add images that you want to be in that library and reuse.  You can always just copy an image out of Microsoft Paint and paste it into DAQFactory directly.  However, it is better to use the PNG load feature of 18.1 as these are smaller. 
Are there preconfigured, resettable totalizers (gallons, elapsed time meters, etc.) or do I have to create scripts and if so, do you have any examples?
No built in, but easy to implement.  Create a Test D/A channel to hold the total.  Set the Persist and History to the same value, maybe just 1.  In a sequence marked autostart, add this code (assuming the channel was named "total":)
if (isempty(total[0]))
   total = 0
This just initializes the total channel and only will ever run once if Persist is working.  Finally, in the channel you are trying to totallize, go to it's event and enter script similar to this:
total = myChannel[0] - myChannel[1]
How do I create a graph control to view a previous point in time and width (back 5 days with a trend width of .01 days)?
Use the scale from and scale to expressions in the graph control along with a couple variables to hold the range.  Alternatively, create a name for your graph and then access those parameters directly through component.mygraph.bottomAxis.strScaleFrom / To.  You'll also need to turn "UseTimeWidth" off. 
Data persistence doesn’t seem to work consistently (frequent data loss on DAQF start/stop with same project file)?
Is there a persist folder under c:\DAQFactory\persist and is it writable?  Are you getting any sort of error messages?  Note that persist files are by name, and if you run a second document that has overlap in channel names, it will cause the persist files to change.
Link to comment
Share on other sites

For the HOA: You can't do it this way with a radio.  The radio can only handle a set channel, not an expression (which is why it doesn't show with a red/green background.  I'd consider using a descriptive text or symbol component.  For example, see attached.  Doing it with a radio is more involved.  You would have to calculate the current state based on those two bits, and then break it apart when the radio changes.  That would involve some script.  It would be easier to simply make your own radio, which I also did in the attached using 3 buttons and 3 LED controls.  You could use a wide variety of things for this.


HOA Sample.ctl

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.