Author Topic: Parameter files  (Read 1468 times)

kf4ozb

  • Newbie
  • *
  • Posts: 16
    • View Profile
Parameter files
« on: December 15, 2016, 08:35:47 AM »
I've searched the boards, and if the solution to this is here I over looked it. 

What I'm wanting to do is create a single form that gets a parameter file passed to it. The parameter file would contain indexed tags that would be distributed to controls upon loading the form.

 I can create a form for each "station" but this is really inefficient. The ability to have one form whose tag references change based on an INI file would be very beneficial.  Is this something AdvancedHMI can do currently?  If not, I'll try to develop a solution and submit it for inclusion in to the next release for AdvancedHMI. Do you have any recommendations on how to go about implementation?

I'm currently leaning toward adding a property to the FormChangeButton Control that specifies the INI file.  Then maybe a subroutine in a module file that can be called on form load that will iterate over a collection of objects in the target form that does a search and replace for the index with tag.


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Parameter files
« Reply #1 on: December 15, 2016, 08:46:41 AM »
This could be a place to start..... If you look at the file EthernetIPforCLXCom.vb , at the end is a Region named IniFileHandling. I haven't tested this, but that region of code should be able to be copied to any control (e.g. BasicLabel) and give it the ability to be configured via INI file.

Before opening the form, you would have to find every control on the form with the INIFileName property and set it.

kf4ozb

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Parameter files
« Reply #2 on: December 15, 2016, 02:32:00 PM »
You can copy it with some caveats...

The SetPropertiesByIniFile subroutine the Utilities.vb in the drivers module had to be copied to the Utilities.vb in the Controls Module and the IniParser.vb had to be copied into the AdvancedHMIControls\Common folder.  There may be a more elegant way to accomplish this, but this works for now.

Also the Implements System.ComponentModel.IComponent, Implements System.ComponentModel.ISupportInitialize lines in the class definition were inserted in the component class.


kf4ozb

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Parameter files
« Reply #3 on: December 15, 2016, 02:34:09 PM »
Just realized I'm a few revisions behind... You may have already taken care of what I had to copy in the new release.