Author Topic: Change Text based on boolean Value (BasicLabel)  (Read 1271 times)

Efabe

  • Newbie
  • *
  • Posts: 2
    • View Profile
Change Text based on boolean Value (BasicLabel)
« on: March 09, 2021, 01:11:38 PM »
Good Afternoon

Greetings from Portugal!
I'am new at AdvancedHmi making now my first application.

I have a basic question, Is it possible to display words based on boolean value with basiclabel?

I

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Change Text based on boolean Value (BasicLabel)
« Reply #1 on: March 09, 2021, 01:42:45 PM »
The BooleanDisplay property gives a limited number of options. Or you could modify the code for the BasicLabel

Efabe

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Change Text based on boolean Value (BasicLabel)
« Reply #2 on: March 09, 2021, 03:21:54 PM »
Thank you for the fast response.

And congratulations for your work.

Do you have any little example ou to manipulate de code of basiclabel?

Would this works?

Private Sub BasicLabel(sender As Object, e As EventArgs) Handles BasicLabel1.ValueChanged
        If BasicLabel1.PLCAddressValue = False Then

            BasicLabel1.Text = "Texto"
        Else
            BasicLabel1.Text = "Texto 34"
        End If
    End Sub


More one time.
Thank you

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Change Text based on boolean Value (BasicLabel)
« Reply #3 on: March 09, 2021, 03:28:43 PM »
- In Solution Explorer expand down the AdvancedHMIControls project
- Expand down the Controls Folder
- Right Click BasicLabel.vb and select View Code
- Go to Line 294 and look for the code:
Code: [Select]
    Public Enum BooleanDisplayOption
        TrueFalse
        YesNo
        OnOff
        OneZero
        EnabledDisabled
        AutoManual
    End Enum

- Add Additional Options
- Then go to line 551 and look for this line of code:
Code: [Select]
            If (String.Compare(m_Value, "True", True) = 0) Then
- Follow the pattern and add If=Then for the options you added above