Author Topic: BasicLabel with context menu (multiple address access)  (Read 5446 times)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
BasicLabel with context menu (multiple address access)
« on: November 28, 2017, 03:40:34 PM »
Could be used for a quick read/write access to any address from its collection (which is populated by the user).

The context menu, which pops up on the right-click of the mouse, will have the address selected for the currently shown value, as the attached picture shows.

PLCAddressValue doesn't have to be populated for as long as at least 1 address has been entered in the PLCAddressKeypad collection or unless you wish to see the value of a specific address at startup.

KeypadFontColor will only be applied to the AlphaKeyboard and will not have effect on the Keypad. This since KeypadV2, which is used in the latest editions of AHMI, might have slightly odd "invisible characters" issue until the mouse is hovered over.

This particular version of the modified BasicLabel has new default CommentSeparators value, which is " ~ " (space-tilde-space), as the attached picture shows.

There are some new properties:
- "SetPrefixAsCurrentPLCAddress", so the currently selected address And/Or its description can be seen on the label along with the value (this is determined by another new property "SetPrefixAs"), as the attached picture shows
- "SetReadOnlyMode" property which prevents writes thus has the BasicLabel only show the value of the currently selected PLCAddress

Important!
As of this last edit, which also included new picture and updated file, since Archie has updated drivers for string reading/writing then you should stick with the file from this post and just read the rest of the posts in this topic so you can understand how everything evolved with the time.
It is sufficient to just add this new control as existing item to the PurchasedControls folder inside the AdvancedHMIControls project, close all open forms and rebuild the solution.
« Last Edit: June 05, 2019, 03:41:33 AM by Godra »

Phrog30

  • Guest
Re: BasicLabel with context menu (multiple address access)
« Reply #1 on: November 28, 2017, 04:52:32 PM »
Most users will have zero idea on what those choices mean. Text would be a better idea.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: BasicLabel with context menu (multiple address access)
« Reply #2 on: November 28, 2017, 06:27:04 PM »
You might be correct so I have added an option to put descriptive comments after the address.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: BasicLabel with context menu (multiple address access)
« Reply #3 on: January 12, 2018, 11:37:02 PM »
This control was updated and file replaced in the initial post.

The new updates relate to reading custom length CLX strings and are described in this topic:

https://www.advancedhmi.com/forum/index.php?topic=1973.0
« Last Edit: May 21, 2019, 02:34:53 PM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: BasicLabel with context menu (multiple address access)
« Reply #4 on: January 17, 2018, 09:57:16 PM »
The latest addition to this modified BasicLabel is ability to Read/Write predetermined length Modbus string. Predetermined length would actually denote the number of elements (or words or Modbus addresses) so any string that is equal or shorter than that number, will fit in.

There are 2 new properties, InterpretValueAsModbusString and ModbusStringLength.
The driver's MaxReadGroupSize property will have to be adjusted to accommodate the length for all the labels used on the form.

One thing that doesn't work for this particular version of the BasicLabel control is access to multiple Modbus addresses (so each label can only read a string from one Modbus address).

There might be bugs so do report them.

In order to have this control work,you would also have to replace the SubscriptionHandler file with the attached modified version.
The new BasicLabel control is also attached in this post.

This might be useful until Archie implements string reading into Modbus drivers. << Implemented in 3.99y version

Note: This particular version of the modified BasicLabel has new default CommentSeparators value, which is " ~" (space-tilde), because the previous default value of space-slash-slash was causing a slash to disappear from address like B3:0/0.
« Last Edit: May 21, 2019, 02:38:03 PM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: BasicLabel with context menu (multiple address access)
« Reply #5 on: January 26, 2018, 12:38:55 AM »
The modified BasicLabel control in my previous post was updated and replaced.

Thanks to some Modbus related suggestions made by Archie, I think that this current version shows improvement and is working better.
« Last Edit: January 26, 2018, 12:40:59 AM by Godra »

larryhts

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: BasicLabel with context menu (multiple address access)
« Reply #6 on: January 26, 2018, 06:34:22 AM »
The modified BasicLabel control in my previous post was updated and replaced.

Thanks to some Modbus related suggestions made by Archie, I think that this current version shows improvement and is working better.

Godra, I tried it this morning but it errors out at the build.

"SubscriptionHandler is not defined" 2
"SubscriptionHandlerEventArgs' is not defined "

I will try a clean project later and let you know.

Thanks Larry

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: BasicLabel with context menu (multiple address access)
« Reply #7 on: May 11, 2019, 02:16:42 AM »
There have been some changes/explanations applied to this control.
Read the very first post.
« Last Edit: May 13, 2019, 08:15:45 PM by Godra »