Hi Guys
I am trying to enable/disable one of the Top Right Buttons programmatically (or show/hide it if can't be enabled/disabled).
Can someone give me a few pointers (lets say I want to disable button #1 then re-enable it).
Page1.TopRightButtons is a List of BarButtons. You can recognize BarButton, for example, by Tag property.
B4X:
For Each b As BarButton In Page1.TopRightButtons
If b.Tag = "..." Then b.Enabled = False ' Or True
Next
In addition you need to think about 'enabled/disabled' colors.
For example, you use Erel's CreateFABarButton from https://www.b4x.com/android/forum/threads/barbutton-icons.74192/#content
b.InitializeCustom (...) sets a color for normal and highlighted states only.
So, you need to add something like this
B4X:
Dim no As NativeObject = b
no.RunMethod ("setTitleColor:forState:", Array (no.ColorToUIColor (Colors.LightGray), 2))