AdvancedHMI Software

General Category => Additional Components => Topic started by: abouhaa on April 04, 2019, 02:20:06 PM

Title: Adding extra properties to controls
Post by: abouhaa 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.
Title: Re: Adding extra properties to controls
Post by: Phrog30 on April 04, 2019, 02:46:29 PM
https://www.advancedhmi.com/forum/index.php?topic=1338.msg7106#msg7106
Title: Re: Adding extra properties to controls
Post by: abouhaa on April 04, 2019, 03:54:37 PM
Perfect, thanks.
Title: Re: Adding extra properties to controls
Post by: abouhaa 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?
Title: Re: Adding extra properties to controls
Post by: Archie 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.
Title: Re: Adding extra properties to controls
Post by: Phrog30 on April 04, 2019, 06:54:12 PM
I've never used the pilot light, what exactly is there to disable?
Title: Re: Adding extra properties to controls
Post by: abouhaa on April 05, 2019, 09:09:03 AM
The pilot light contains a basicbutton; I want to disable that button
Title: Re: Adding extra properties to controls
Post by: abouhaa 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.
Title: Re: Adding extra properties to controls
Post by: Phrog30 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
Title: Re: Adding extra properties to controls
Post by: abouhaa 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. 
Title: Re: Adding extra properties to controls
Post by: Phrog30 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.
Title: Re: Adding extra properties to controls
Post by: Phrog30 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.
Title: Re: Adding extra properties to controls
Post by: Archie 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?
Title: Re: Adding extra properties to controls
Post by: abouhaa 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
Title: Re: Adding extra properties to controls
Post by: abouhaa 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?
Title: Re: Adding extra properties to controls
Post by: Phrog30 on April 05, 2019, 01:18:32 PM
I just added two new analog display value controls to a form.  I changed the cursor to hand, didn't add any PLC property values, and changed enabled to false on one, but left the other true.  Then run the app, you can slightly see the text a different color, but you will also see the one enabled is still hand cursor, the one not enabled is not hand.  The controls take care of this automatically, so that tells me the enabled is working as it should.  On my controls, anything that allows an operator input I change the cursor to hand.  This is a good sign to them.  I also draw a box around the control on mouse enter, kind of works like wonderware.  This was something I added. 
Title: Re: Adding extra properties to controls
Post by: Archie on April 05, 2019, 01:20:10 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
Can you explain the reasoning? Is your PLC program overwriting what is written by the HMI?
Title: Re: Adding extra properties to controls
Post by: Phrog30 on April 05, 2019, 01:23:39 PM
I just added two new analog display value controls to a form.  I changed the cursor to hand, didn't add any PLC property values, and changed enabled to false on one, but left the other true.  Then run the app, you can slightly see the text a different color, but you will also see the one enabled is still hand cursor, the one not enabled is not hand.  The controls take care of this automatically, so that tells me the enabled is working as it should.  On my controls, anything that allows an operator input I change the cursor to hand.  This is a good sign to them.  I also draw a box around the control on mouse enter, kind of works like wonderware.  This was something I added. 


Oh, did the same on the pilot light as well, it worked the same, so it's working.  It's simply the differences aren't that noticeable.  So, you will need to use other means to make it more noticeable, some of which I already shared.
Title: Re: Adding extra properties to controls
Post by: Phrog30 on April 05, 2019, 01:26:56 PM
Can you explain the reasoning? Is your PLC program overwriting what is written by the HMI?

If this is true, I can say that every SCADA/HMI software would work no differently.  If the PLC/HMI are "fighting" each other it's not going to work.  I use momentary all of the time, usually when doing a jog.  The functionality also depends on touchscreen, some touchscreen drivers don't allow you to hold/jog, use a mouse to test with if this is the case.
Title: Re: Adding extra properties to controls
Post by: abouhaa on April 05, 2019, 01:54:55 PM
I just added two new analog display value controls to a form.  I changed the cursor to hand, didn't add any PLC property values, and changed enabled to false on one, but left the other true.  Then run the app, you can slightly see the text a different color, but you will also see the one enabled is still hand cursor, the one not enabled is not hand.  The controls take care of this automatically, so that tells me the enabled is working as it should.  On my controls, anything that allows an operator input I change the cursor to hand.  This is a good sign to them.  I also draw a box around the control on mouse enter, kind of works like wonderware.  This was something I added.

Cursors wont works because I have touch screen so no mouse hovering hence I cant switch the cursor
Title: Re: Adding extra properties to controls
Post by: abouhaa on April 05, 2019, 02:03:13 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
Can you explain the reasoning? Is your PLC program overwriting what is written by the HMI?

No my PLC is not overwriting; it cannot simply because you cannot map a bit to a bit being mapped already on the PLC. They would fight and the PLC will win any time in the day. The reason I want to have that is because this is what operators are used to on all other platforms; they are used to holding the button for whatever time and let go.

A good example is that if someone wants to manually jog a motor to a certain position while watching the motor run. This will not work since holding the button and then letting go the second they desire the motor stopped is not how the basicbutton reacts to the user input. I think this is an inheritance from system.button as it appears that both work the same way
Title: Re: Adding extra properties to controls
Post by: Phrog30 on April 05, 2019, 02:11:50 PM
You mentioned you are using a touchscreen, I'm guessing that's your problem.  As I said earlier, plug in a mouse and test.  If it works, then you need to find a different touchscreen driver.

Also, I dropped two textboxes and changed background to red, one enabled and one not.  You can't tell the difference on which is one enabled just by looking at them.  One option is to change the background color if not enabled, then it will be noticeable.
Title: Re: Adding extra properties to controls
Post by: Archie on April 05, 2019, 02:17:35 PM
No my PLC is not overwriting; it cannot simply because you cannot map a bit to a bit being mapped already on the PLC. They would fight and the PLC will win any time in the day. The reason I want to have that is because this is what operators are used to on all other platforms; they are used to holding the button for whatever time and let go.

A good example is that if someone wants to manually jog a motor to a certain position while watching the motor run. This will not work since holding the button and then letting go the second they desire the motor stopped is not how the basicbutton reacts to the user input. I think this is an inheritance from system.button as it appears that both work the same way
I agree with Phrog on this. I think it is your touch screen. I do jog buttons all the time. When the button is pressed it sets the bit to True/1, when it is released it sets the value to False/0. Are you using Windows 10 with the default touch screen driver? if so, it functions as gestures and doesn't click on down the same as a mouse would.
Title: Re: Adding extra properties to controls
Post by: abouhaa on April 05, 2019, 03:11:34 PM
I will look into that but I have a feeling it is not the issue because I had the gestures disabled a long time ago.
I am using windows 7 std emb. and on this version holding the button down to jog a motor usually initiates a right click button event..

When I had this issue I went ahead and disabled all the gestures and then I came across the button not holding bit 1 or 0 and the enabled/disabled status issue.

I understand phrog that the controls are working how they are supposed to be but it is not the way they should look like.

The perfect way to disable a control is the way basicbutton works where the difference between enabled and disabled is pretty clear to the user and not just a slight modification to the text etc etc.

Almost every control/component on the microsoft.system gets greyed out when disabled.

You gotta think that this product is mostly going to be used on touchscreen like the rest of the industry not on a mouse and keyboard.
Title: Re: Adding extra properties to controls
Post by: Archie on April 05, 2019, 03:18:49 PM
I will look into that but I have a feeling it is not the issue because I had the gestures disabled a long time ago.
I am using windows 7 std emb. and on this version holding the button down to jog a motor usually initiates a right click button event..
You need to disable the right click on hold.
Title: Re: Adding extra properties to controls
Post by: Phrog30 on April 05, 2019, 03:44:54 PM
Almost every control/component on the microsoft.system gets greyed out when disabled.
It depends on the backcolor!
See photo.

Edit, those are "standard" winforms controls!
Title: Re: Adding extra properties to controls
Post by: abouhaa on April 08, 2019, 08:04:41 AM
Almost every control/component on the microsoft.system gets greyed out when disabled.
It depends on the backcolor!
See photo.

Edit, those are "standard" winforms controls!

True, the back color makes a difference; however I should at least be able to have 1 color that will give me the same visual effect of the basicbutton. No?
Title: Re: Adding extra properties to controls
Post by: Godra on May 25, 2019, 02:39:51 PM
Maybe check the attached picture and also this link:

http://www.vbforums.com/showthread.php?803457-RESOLVED-Button-doesn-t-gray-out-when-disabled

All buttons in the picture have the BackColor set to Control and both AnalogValueDisplay controls have it set to ControlDarkDark.
Top row controls are enabled and bottom row are disabled.