Author Topic: HourMeter / Odometer  (Read 8408 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: HourMeter / Odometer
« Reply #15 on: May 18, 2016, 08:51:08 PM »
I updated RollingDigit.vb to overlay the gradient on top of  the digits in order to give a more realistic effect. I updated the file in the prior post.

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: HourMeter / Odometer
« Reply #16 on: May 19, 2016, 04:16:20 PM »
Archie,

I included this RollingDigit as friend class inside the Odometer class and the control still works fine.

Just curious if you separated them for a reason?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: HourMeter / Odometer
« Reply #17 on: May 19, 2016, 05:31:00 PM »
I included this RollingDigit as friend class inside the Odometer class and the control still works fine.

Just curious if you separated them for a reason?
I separated them mainly for code re-use and maintainability. I considered the RollingDigit as a primitive that could be re-used by controls other than the odometer. I almost made a 3rd level of a RollingImage which would be used by the RollingDigit, but I didn't want to over complicate a simple example of control creation. My goal was to demonstrate what is considered good practices of Object Oriented Programming by creating small, re-usable, and specific purpose classes.

Although multiple classes can be combined in a single file with the same result, I like to keep them in separate files so when I look in Solution Explorer I can open the class using the file with the same name.

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: HourMeter / Odometer
« Reply #18 on: May 23, 2016, 10:32:52 AM »
Attached in this post is the HourMeter / Odometer control using Archie's controls.

I had to make some modifications to the code and have also included the RollingDigit inside the attached class.

Right-clicking the control will provide menu options (this feature can be disabled but then the PLC would have to take over the control).

The control can also show Days in the HourMeter mode (format HHHH:mm:ss can be changed to DD:HH:mm:ss).
Do note the difference with current number of digits the control has:

  - Format HHHH:mm:ss can show up to 9999 hours = 416 days
  - Format DD:HH:mm:ss can show up to 99 days

The control seems to be working fine. Read the comments at the beginning of the file for features.

As suggested previously, when controlled by a PLC then these Start/Stop/Reset.. bits will be active only when changing state from False to True (or True to False if using NOT prefix).
« Last Edit: August 03, 2018, 07:56:22 PM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: HourMeter / Odometer
« Reply #19 on: July 29, 2018, 11:19:05 AM »
The control in the previous post was updated and replaced.
It can be tested in the Designer by changing the value of the Value property and, if in the HourMeter mode, by setting the HM_ValueSource to "External".

Attached in this post is that same control but without the RollingDigit class.
It actually points to the AHMI built-in RollingDigit, which has been available since the time Archie included it in the AHMI solution (it looks like it was in the v3.99g in particular - all versions prior to this should try using the control from previous post).

Read the comments at the beginning of the file for features.
« Last Edit: July 31, 2018, 10:39:20 PM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: HourMeter / Odometer
« Reply #20 on: July 31, 2018, 10:41:06 PM »
Both files were updated and replaced.

The HourMeter Days and Minutes digits back color can now be set individually.