I have this simple Sub for setting the required menu group:
I need the Sleep(0) as otherwise the buttons won't hide.
I used to have the line: iCurrentMenuGroup = iMenuGroup after the If code block, but found out that it won't run
with the Sleep(0) in place. Luckily there is no problem put that line before the If code block and then all is well.
Is this normal behaviour?
What if for some reason I needed to have that line after the If code block?
RBS
B4X:
Sub ShowMenuGroup(iMenuGroup As Int)
Dim i As Int
For i = 1 To 5
ActionBar.Menu.SetGroupVisible(i, i = iMenuGroup)
Next
iCurrentMenuGroup = iMenuGroup
If iMenuGroup = 5 Then
Sleep(0) 'this is needed, otherwise buttons remain visible!
Dim bVisible As Boolean = General.iCurrentPanelType <> Enums.ePanelType.ShowWebview
ActionBar.Menu.GetItem(Enums.eMenuButtonType.PreviousPanel).Visible = bVisible
ActionBar.Menu.GetItem(Enums.eMenuButtonType.NextPanel).Visible = bVisible
End If
End Sub
I need the Sleep(0) as otherwise the buttons won't hide.
I used to have the line: iCurrentMenuGroup = iMenuGroup after the If code block, but found out that it won't run
with the Sleep(0) in place. Luckily there is no problem put that line before the If code block and then all is well.
Is this normal behaviour?
What if for some reason I needed to have that line after the If code block?
RBS