Author Topic: NumericUpDown as AHMI control  (Read 5130 times)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
NumericUpDown as AHMI control
« on: March 29, 2016, 07:33:08 PM »
This is my attempt at converting NumericUpDown control to AHMI control.

It is using PLCAddressValue property to both read from and write to (tried it with ModRSSim simulator and it worked fine).

Its ReadOnly property is initially set to True, so it will only allow changing value with arrows (change it if you want to manually enter the value in the box).

First file is for older versions of AHMI and the second one is for v3.99d.

Check later posts for updated controls.
« Last Edit: December 11, 2019, 09:03:53 PM by Godra »

StefanA

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: NumericUpDown as AHMI control
« Reply #1 on: April 24, 2016, 02:52:46 AM »
Hi Godra,

Nice component, excellent alternative to the keypad. Would it be possible to make it resizable? When running AHMI on a tablet it's a bit tricky to hit the right spot especially with my sausage fingers  :)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: NumericUpDown as AHMI control
« Reply #2 on: April 25, 2016, 04:52:44 PM »
If you increase the font size that will automatically increase the height of the NumericUpDown control and buttons on it.

I am not sure if there is any other way to change this control.

One thing to suggest would be using a stylus to compensate for the "sausage" fingers.
Stylus is a rather useful tool for touch screens and has become rather inexpensive.
« Last Edit: October 25, 2016, 05:45:48 PM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: NumericUpDown as AHMI control
« Reply #3 on: January 12, 2017, 11:36:41 AM »
This control has been updated to better handle fast poll rates.

The ReadOnly property is now set to its default value.

PLCAddressValue property was removed and a new PLCAddressReadWrite property is included to handle the address.

The following issue seems to be resolved now (at least with ethernet drivers):
The control will respond slow if the up/down arrow buttons are clicked repeatedly too fast or if they are held pressed.
In this case, using the box to manually enter the desired new value should be a better choice (or possibly change the Increment property value to handle bigger changes).
« Last Edit: December 05, 2017, 11:38:13 PM by Godra »

Phrog30

  • Guest
Re: NumericUpDown as AHMI control
« Reply #4 on: June 26, 2017, 03:16:22 PM »
This component does have a bug that if you read the PLC value into the component and it's less than or greater than it's min/max it will throw an exception.

This should prevent that:
Code: [Select]
Private m_readWrite As Decimal
    <System.ComponentModel.Browsable(False)> _
    Public Property ReadWrite As Decimal
        Get
            Return Me.m_readWrite
        End Get
        Set(value As Decimal)
            If Me.m_readWrite <> value Then
                Me.m_readWrite = value
                If Me.m_readWrite >= Minimum AndAlso Me.m_readWrite <= Maximum Then
                    MyBase.Value = Me.m_readWrite
                End If
                Me.Invalidate()
                End If
        End Set
    End Property
« Last Edit: June 26, 2017, 03:19:41 PM by Phrog30 »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: NumericUpDown as AHMI control
« Reply #5 on: November 12, 2017, 03:17:38 PM »
The control in my previous post was updated and replaced.

It includes a bug fix mentioned by Phrog30 and it also seems to have resolved the issue of responding slow if the up/down arrow buttons were clicked repeatedly too fast or if they were held pressed.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: NumericUpDown as AHMI control
« Reply #6 on: December 10, 2017, 06:46:35 PM »
This control was modified and updated, with this new version attached in this post.

 A new property was added, AllowWriteOnly, which is set to True as default.
If you want the control to as well read the current PLC address then change this value.
« Last Edit: December 10, 2017, 11:10:00 PM by Godra »