K kostefar Active Member Licensed User Longtime User Aug 23, 2017 #1 Dear All, I have the 3-dot menu set in my actionbar with Code: Copy ACToolBarLight1.InitMenuListener Sub Activity_CreateMenu(Menu As ACMenu) Menu.Clear Menu.Add(0, 0, "Blahblah", Null) Menu.Add(1, 0, "Blahblahblah", Null) End Sub This is something I want to appear when the actionbar shows only sometimes. How can I hide the menu and unhide it again? I´ve searched the forum, but wasn´t sure if the question was exactly the same, so please bare with me if that´s indeed the case. Thanks in advance!
Dear All, I have the 3-dot menu set in my actionbar with Code: Copy ACToolBarLight1.InitMenuListener Sub Activity_CreateMenu(Menu As ACMenu) Menu.Clear Menu.Add(0, 0, "Blahblah", Null) Menu.Add(1, 0, "Blahblahblah", Null) End Sub This is something I want to appear when the actionbar shows only sometimes. How can I hide the menu and unhide it again? I´ve searched the forum, but wasn´t sure if the question was exactly the same, so please bare with me if that´s indeed the case. Thanks in advance!
DonManfred Expert Licensed User Longtime User Aug 23, 2017 #2 Menu.Create return as Menuitem-Object. I think you can use this Object and change it´s properties. Visible, Enabled https://www.b4x.com/android/help/stdactionbarhelper.html#menuitem Upvote 0
Menu.Create return as Menuitem-Object. I think you can use this Object and change it´s properties. Visible, Enabled https://www.b4x.com/android/help/stdactionbarhelper.html#menuitem
K kostefar Active Member Licensed User Longtime User Aug 23, 2017 #3 DonManfred said: Menu.Create return as Menuitem-Object. I think you can use this Object and change it´s properties. Visible, Enabled https://www.b4x.com/android/help/stdactionbarhelper.html#menuitem Click to expand... Hi DonManfred, Excellent, let´s see what I can do. Then I´ll come back with the result here. Thanks! Upvote 0
DonManfred said: Menu.Create return as Menuitem-Object. I think you can use this Object and change it´s properties. Visible, Enabled https://www.b4x.com/android/help/stdactionbarhelper.html#menuitem Click to expand... Hi DonManfred, Excellent, let´s see what I can do. Then I´ll come back with the result here. Thanks!
K kostefar Active Member Licensed User Longtime User Aug 25, 2017 #4 Hi again, Now you can call me lazy or a patient digger for simplicity or none of those. I could see stuff would be working with what you suggested but I wanted to keep changes to as few as possible: The more you change, the more can go wrong later. So I suddenly figured out how simple it can be done. In the globals, put something like: Code: Copy Dim menuon as boolean Private ACToolBarLight1 As ACToolBarLight Then set the createmenu event up like this: Code: Copy Sub Activity_CreateMenu(Menu As ACMenu) Menu.Clear If menuon = True Then Menu.Add(0, 0, "w", Null) Menu.Add(1, 0, "x", Null) Menu.Add(2, 0, "y", Null) Menu.Add(3, 0, "z", Null) End If End Sub Then whenever you want the menu to appear, put this in your code: Code: Copy menuonfirst = True ACToolBarLight1.InitMenuListener And when you want it to disappear: Code: Copy menuonfirst = False ACToolBarLight1.InitMenuListener You could of course set things up with more choices than just the menu on and off, but for me this was all I needed. Edit: You´ll need to load a new activity with the Actoolbarlight in it for this to work. The listener won´t fire if you don´t do that. Last edited: Aug 28, 2017 Upvote 0
Hi again, Now you can call me lazy or a patient digger for simplicity or none of those. I could see stuff would be working with what you suggested but I wanted to keep changes to as few as possible: The more you change, the more can go wrong later. So I suddenly figured out how simple it can be done. In the globals, put something like: Code: Copy Dim menuon as boolean Private ACToolBarLight1 As ACToolBarLight Then set the createmenu event up like this: Code: Copy Sub Activity_CreateMenu(Menu As ACMenu) Menu.Clear If menuon = True Then Menu.Add(0, 0, "w", Null) Menu.Add(1, 0, "x", Null) Menu.Add(2, 0, "y", Null) Menu.Add(3, 0, "z", Null) End If End Sub Then whenever you want the menu to appear, put this in your code: Code: Copy menuonfirst = True ACToolBarLight1.InitMenuListener And when you want it to disappear: Code: Copy menuonfirst = False ACToolBarLight1.InitMenuListener You could of course set things up with more choices than just the menu on and off, but for me this was all I needed. Edit: You´ll need to load a new activity with the Actoolbarlight in it for this to work. The listener won´t fire if you don´t do that.