D davemorris Active Member Licensed User Longtime User Oct 5, 2020 #1 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). Kind regards Dave Morris
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). Kind regards Dave Morris
Semen Matusovskiy Well-Known Member Licensed User Oct 6, 2020 #2 Page1.TopRightButtons is a List of BarButtons. You can recognize BarButton, for example, by Tag property. Code: Copy 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 Code: Copy Dim no As NativeObject = b no.RunMethod ("setTitleColor:forState:", Array (no.ColorToUIColor (Colors.LightGray), 2)) Upvote 0
Page1.TopRightButtons is a List of BarButtons. You can recognize BarButton, for example, by Tag property. Code: Copy 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 Code: Copy Dim no As NativeObject = b no.RunMethod ("setTitleColor:forState:", Array (no.ColorToUIColor (Colors.LightGray), 2))