Author Topic: Adding extra properties to controls  (Read 7365 times)

abouhaa

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Adding extra properties to controls
« on: April 04, 2019, 02:20:06 PM »
Is it possible to modify the controls like "AnalogValueDisplay" or "PilotLight" to include a property "PLCAddressEnabled"?
Right now I can only use "PLCAddressVisible".
Some other controls like "BasicButton" carries both properties visible and enabled.


abouhaa

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Adding extra properties to controls
« Reply #2 on: April 04, 2019, 03:54:37 PM »
Perfect, thanks.

abouhaa

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Adding extra properties to controls
« Reply #3 on: April 04, 2019, 04:34:35 PM »
So I have added the property and it works as expected except it does not grey out the pilot light or the analog value display like the basicbutton does.. Am I missing something?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Adding extra properties to controls
« Reply #4 on: April 04, 2019, 05:06:26 PM »
I think it does but the change is extremely subtle. Change the Forecolor to White and you will see the difference between Enabled and disabled

EDIT : This is not the case. Since the AnalogValueDisplay overrides the colors based on limit values, it will not dim it out when disabled. You can modify the code to do it.
« Last Edit: April 04, 2019, 07:22:14 PM by Archie »

Phrog30

  • Guest
Re: Adding extra properties to controls
« Reply #5 on: April 04, 2019, 06:54:12 PM »
I've never used the pilot light, what exactly is there to disable?

abouhaa

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Adding extra properties to controls
« Reply #6 on: April 05, 2019, 09:09:03 AM »
The pilot light contains a basicbutton; I want to disable that button

abouhaa

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Adding extra properties to controls
« Reply #7 on: April 05, 2019, 09:23:29 AM »
I think it does but the change is extremely subtle. Change the Forecolor to White and you will see the difference between Enabled and disabled

EDIT : This is not the case. Since the AnalogValueDisplay overrides the colors based on limit values, it will not dim it out when disabled. You can modify the code to do it.

How does a basicbutton do the grey out? How Can I modify the code of pilotlight to grey out the way basic button does ignoring the in or out of limits of pilot light?

The code for basicbuttin enabled is this:
    Private m_PLCAddressEnabled As String = ""
    <System.ComponentModel.DefaultValue("")>
    <System.ComponentModel.Category("PLC Properties")>
    Public Property PLCAddressEnabled() As String
        Get
            Return m_PLCAddressEnabled
        End Get
        Set(ByVal value As String)
            If m_PLCAddressEnabled <> value Then
                m_PLCAddressEnabled = value

                '* When address is changed, re-subscribe to new address
                SubscribeToComDriver()
            End If
        End Set
    End Property

How does that end up changing the property of greying the control out and siabling it? I want to do the same thing to the pilot light.

Thanks.

Phrog30

  • Guest
Re: Adding extra properties to controls
« Reply #8 on: April 05, 2019, 10:36:14 AM »

How does that end up changing the property of greying the control out and siabling it? I want to do the same thing to the pilot light.

Thanks.

Did you read the thread I linked? You can reference most properties, in this case enabled. A button has that property. Does the pilot light? Personally, I wouldn't use a pilot light as a button, it's not intuitive for operators. Use a button. But, Archie should add that into his control to be consistent.

This thread may explain in better detail how it works,
https://www.advancedhmi.com/forum/index.php?topic=481.msg1849#msg1849
« Last Edit: April 05, 2019, 10:40:32 AM by Phrog30 »

abouhaa

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Adding extra properties to controls
« Reply #9 on: April 05, 2019, 11:16:00 AM »

How does that end up changing the property of greying the control out and siabling it? I want to do the same thing to the pilot light.

Thanks.

Did you read the thread I linked? You can reference most properties, in this case enabled. A button has that property. Does the pilot light? Personally, I wouldn't use a pilot light as a button, it's not intuitive for operators. Use a button. But, Archie should add that into his control to be consistent.

This thread may explain in better detail how it works,
https://www.advancedhmi.com/forum/index.php?topic=481.msg1849#msg1849

I read your link and I did reference the "Enabled" property on the pilot light; the only problem is that I want it to change color/grey out when it gets disabled just like a basicbutton.

Personally I find the pilot light more convenient than a basic button in some cases..

Also, the problem is not with the pilot light only, I used the pilot light as an example. I have the same issue with the "analogvaluedisplay" where I also was able to add the "enabled" property on it but it does not grey out when disabled.

All controls have to grey out when disabled to inform the user that something has changed on this control.
It would be great if all the controls were consistent.

On the side, is there a way to make a "basicbutton" change "backcolor" when pressed and back to original color when not pressed? Also is there a way to make a "basicbutton" write the value to the plc even if the user is still holding the button? Right now the "basicbutton" needs to see a rising edge and a falling edge before firing the write event... That's not necessarily helpful. 

Phrog30

  • Guest
Re: Adding extra properties to controls
« Reply #10 on: April 05, 2019, 11:47:56 AM »
Couldn't agree more about being consistent. But, what you see is what you get. When I see something I don't like, I change it. That's the great thing about being open source.

I might have an analog control that works the way you want. I'll check later. I don't for the light as I've never used it and don't plan on it.

On the button, try momentary and use the same address for click as highlight.

Phrog30

  • Guest
Re: Adding extra properties to controls
« Reply #11 on: April 05, 2019, 11:54:55 AM »
By the way, you should be able to toggle the property values to see what they will do, without going through the trouble of adding code. Just manually do it to start with.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Adding extra properties to controls
« Reply #12 on: April 05, 2019, 12:06:56 PM »
On the side, is there a way to make a "basicbutton" change "backcolor" when pressed and back to original color when not pressed? Also is there a way to make a "basicbutton" write the value to the plc even if the user is still holding the button? Right now the "basicbutton" needs to see a rising edge and a falling edge before firing the write event... That's not necessarily helpful.
Are you wanting the button to repeatedly keep writing the same value as long as the button is held?

abouhaa

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Adding extra properties to controls
« Reply #13 on: April 05, 2019, 12:29:16 PM »
On the side, is there a way to make a "basicbutton" change "backcolor" when pressed and back to original color when not pressed? Also is there a way to make a "basicbutton" write the value to the plc even if the user is still holding the button? Right now the "basicbutton" needs to see a rising edge and a falling edge before firing the write event... That's not necessarily helpful.
Are you wanting the button to repeatedly keep writing the same value as long as the button is held?

yes

abouhaa

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Adding extra properties to controls
« Reply #14 on: April 05, 2019, 12:31:58 PM »
Couldn't agree more about being consistent. But, what you see is what you get. When I see something I don't like, I change it. That's the great thing about being open source.

I might have an analog control that works the way you want. I'll check later. I don't for the light as I've never used it and don't plan on it.

On the button, try momentary and use the same address for click as highlight.

That is what I have been trying to do.. change it. How?