Author Topic: Use an internal variable to change the tags labels and buttons are connected to  (Read 235 times)

PLCHorse

  • Newbie
  • *
  • Posts: 19
    • View Profile
I hope i can explain myself here.

Im trying to set up a page where all the fields for a given Part[PartSelection] are changed. I could write a getter/setter wrapper in the PLC to achieve this but I wonder if the HMI can do it for me. So i am imagining that there would be some selection or menu in the form which lets you select the part number that you are editing. This selection would then change - in masse - the tags that the buttons and labels on the form go to in the PLC. I may need an ini for this - thats the way i was imagining would be INIfile[PartSelection] - tagName

I also don't know how to set an internal variable with the VisualBasic software. I am rather new to it.

Thoughts appreciated.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5306
    • View Profile
    • AdvancedHMI
In version 3.99y, there is a RecipeSelect and a RecipeSaveButton.

In the RecipeSaveButton there is a Property of PLCAddressItems that let's you select which tags/registers are parts of the recipe. When the RecipeSaveButton is clicked, it will ask for a RecipeName, then read all of those current values and save them to an INI File.

The RecipeSelect will read the INI file and give a button for each unique Recipe Name that was saved. By clicking the appropriate button, it will write the values back to the PLC.

Is this what you are trying to do?

PLCHorse

  • Newbie
  • *
  • Posts: 19
    • View Profile
From the sound of it i was making it hard on myself.

So if im understanding this feature correctly, i can have any number of Integers, Strings, bits, and so on saved to this recipe file, and load and save the recipe as I want. Then, say if i wanted to do bitwise manipulation of the tags in the recipe, i can do so with buttons mapped to the PLC values, and then satisfied with the edits i can save the recipe and then load it.

Hua ha ha, and to think... prior everything was being done in the PLC...

PLCHorse

  • Newbie
  • *
  • Posts: 19
    • View Profile
Ok, now im wondering: if I have a Messages.ini file being displayed with a DisplayMessagesByNumber object, is there an efficient way to either change the INI file for the messages being used so i can load different message files for different recipes?

So what i am imagining is that the given recipe will have a number of message strings associated with it. The one convolution here is I am trying to have a bank of unique messages as well as the messages in a different language.

So right now as im trying to mentally sketch out how to do this, i have a different DisplayMessageByValue and different INI for each language, then in the recipe i have an offset which is used for MessageNumber+Offset such that say messages 0-50 are for program 1. Messages 51-100 are for program 2, and so on.

Is this the way?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5306
    • View Profile
    • AdvancedHMI
The current version will not re-read the INI File if the INIFile property is changed at run time.

Attached is an update that will allow it.

- Save the attached file
- In Solution Explorer, expand down AdvancedHMIControls project
- Right click the PurchasedControls folder and select Add->Existing Item
- Browse to and select the file downloaded from here
- Expand down the Controls folder
- Right click MessageDisplaByValye and select View code
- Go to the Inherits line 27 and change to:
    Inherits MessageDisplayByValueB
- Rebuild the solution

Now you can change the IniFileName property at run time and it will update from the new file. For example, add a button to the form, double click the button to get to code and enter:

MessageDisplayByValue1.INIFileName = "SpanishMessages.ini"

PLCHorse

  • Newbie
  • *
  • Posts: 19
    • View Profile
This is amazing stuff - thank you.

It seems that I built my project in 3.99x instead of 3.99y is there a way to migrate the screens I built from x to y or do I need to start over fresh?


PLCHorse

  • Newbie
  • *
  • Posts: 19
    • View Profile
I have experienced the power of AdvancedHMI today.

One last question: and thank you again for your time.

Is there a way to indicate to the Operator that the Recipe Save / Recipe Selection Buttons are working? They seem to take a little bit of time - not an issue I'm actually quite amazed by the speed but it is noticable and there is little feedback to say the button is working or not.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5306
    • View Profile
    • AdvancedHMI
- In Visual Studio, in the form designer, select the RecipeSaveButton
- In the properties Window, click the lightening bolt
- Scroll down to RecipeSaved and double click in the box to get back to the code for handling the RecipeSaved event
- Add this line of code:
Code: [Select]
    Private Sub RecipeSaveButton1_RecipeSaved_1(sender As Object, e As EventArgs) Handles RecipeSaveButton1.RecipeSaved
        MsgBox("Recipe save complete")
    End Sub

PLCHorse

  • Newbie
  • *
  • Posts: 19
    • View Profile
- In Visual Studio, in the form designer, select the RecipeSaveButton
- In the properties Window, click the lightening bolt
- Scroll down to RecipeSaved and double click in the box to get back to the code for handling the RecipeSaved event
- Add this line of code:
Code: [Select]
    Private Sub RecipeSaveButton1_RecipeSaved_1(sender As Object, e As EventArgs) Handles RecipeSaveButton1.RecipeSaved
        MsgBox("Recipe save complete")
    End Sub

I used this - works great! thank you again Archie. I couldn't see a similar place to put it for the Recipe load button however, do you think that is possible somehow? I'm writing 901 integers so it does take a few seconds. ;)