B4A Library [Class] ActionBar

Informatix

Expert
Licensed User
Very Nice,

I have a simple question.

Have you made any functions for the overflow menu? The right menu with the 3 dots.
You can do a menu with the AHQuickAction library or the SlidingSidebar class.

And under the overflow menu 5 other menu points. Is this possible.
Could you tell me more ? I don't see what you mean.
 

mrossen

Active Member
Licensed User
Thank for your help.

I will use the SlidingSidebar class. It looks perfect for me.

Mogens
 

barx

Well-Known Member
Licensed User
Just starting to try this. Can set up a bar and buttons no worries. How do you add a title?

Also, can other views be added? I wish to add a textview and use it for search. Maybe I'm thinking along the wrong lines of the use of this. Looks nice so far though.

cheers
 

barx

Well-Known Member
Licensed User
Just a note for future users.

The .AddButton Does NOT return a button, it returns a panel ;)
 

Informatix

Expert
Licensed User
Just starting to try this. Can set up a bar and buttons no worries. How do you add a title?

Also, can other views be added? I wish to add a textview and use it for search. Maybe I'm thinking along the wrong lines of the use of this. Looks nice so far though.
MyActionBar.Title for the title (it's a label)

MyActionBar.AsPanel.AddView to add other views
 

barx

Well-Known Member
Licensed User
MyActionBar.Title for the title (it's a label)

MyActionBar.AsPanel.AddView to add other views
Nice.

How about calculating space.

Say I want a 'x' at right (set to position -1, 48dip wide) and then a 'Search' button (set to position -2, auto size) then I want the edit text to mount left side 5dip in and take up rest of space??

Thought something like

B4X:
btnActionSearch = ActionBar.AddButton(Null, "Search", 7, -2, "btnActionSearch_Click", "")

ActionBar.AsPanel.AddView(ActionBarSearchText, 5dip, 5dip, ActionBar.AsPanel.Width - btnActionSearch.Left, 40dip)
but no joy.

Any tips ;)
 

Informatix

Expert
Licensed User
B4X:
btnActionSearch = ActionBar.AddButton(Null, "Search", 7, -2, "btnActionSearch_Click", "")

ActionBar.AsPanel.AddView(ActionBarSearchText, 5dip, 5dip, ActionBar.AsPanel.Width - btnActionSearch.Left, 40dip)
The right formula is: ActionBar.AsPanel.AddView(ActionBarSearchText, 5dip, 5dip, btnActionSearch.Left - 10dip, 40dip)
 
Last edited:

barx

Well-Known Member
Licensed User
Nice one Info'

Works a treat.
 

barx

Well-Known Member
Licensed User
Loving this class so far. Got one little issue that I don't know if can be sorted in the class or whether I just need to consume the event.

Basically if I add a button but do not specify a _LongClick event name. Then run the app and for some reason end up long clicking. A NullPointerException is raised and app closes.

As I said, not sure if it a bug that requires fixing or if I should just put in a _LongClick name and leave the sub blank.

Thanks and keep up the great work.
 

Informatix

Expert
Licensed User
Loving this class so far. Got one little issue that I don't know if can be sorted in the class or whether I just need to consume the event.

Basically if I add a button but do not specify a _LongClick event name. Then run the app and for some reason end up long clicking. A NullPointerException is raised and app closes.

As I said, not sure if it a bug that requires fixing or if I should just put in a _LongClick name and leave the sub blank.

Thanks and keep up the great work.
Are you using the latest B4A version with the latest Reflection library?
If the OnLongClickSub parameter is left empty in AddButton, there's no reason to raise an exception since the listener is invalidated.
 

barx

Well-Known Member
Licensed User
B4A - 2.20

Reflection 1.90

I tried it with specifying a name for the longclick and simply not writing any sub to match, seems to solve it but guess it wastes resources by creating a un-used/needed listener.

What would you suggest?
 

Informatix

Expert
Licensed User
B4A - 2.20

Reflection 1.90

I tried it with specifying a name for the longclick and simply not writing any sub to match, seems to solve it but guess it wastes resources by creating a un-used/needed listener.

What would you suggest?
Install the latest Reflection lib.
 

barx

Well-Known Member
Licensed User
Cheers for the tip, just updating reflection. Didn't realize there was a later version.
 

barx

Well-Known Member
Licensed User
Sorted, thx
 

wheretheidivides

Active Member
Licensed User
Remember the B in BASIC stands for beginners.

I am a tard and I freely admit it. How do I install this add-on and then call the funtions? I have a menu and just want a simple conversion to a action bar

B4X:
'Menu
   Activity.AddMenuItem("Title Screen","Help") 'top left
   Activity.AddMenuItem("Instructions","Help") 'top center
   Activity.AddMenuItem("Return To Game","Help") 'top right
   
   Activity.AddMenuItem("Zero Stats","Help") 'bottom left
   Activity.AddMenuItem("Debug (On/Off)","Help") 'bottom center
   
   Activity.AddMenuItem("Continuation Bet (On/Off)","Help") 'more 1
   Activity.AddMenuItem("Double/Triple Down (On/Off)","Help") 'more 2
   Activity.AddMenuItem("Split 2 Card Pairs (On/Off)","Help") 'more 3
   Activity.AddMenuItem("Sound Effects (On/Off)","Help") 'more 4
 

Informatix

Expert
Licensed User
Remember the B in BASIC stands for beginners.
I have no obligation to do things for beginners.

I am a tard and I freely admit it. How do I install this add-on and then call the funtions?
It's a class, so copy the file "ClsActionBar.bas" into your project with Add Existing Module and declare it in Globals with Dim MyActionBar As ClsActionBar.

Did you study how the demo is made ?
 

wheretheidivides

Active Member
Licensed User
I have no obligation to do things for beginners.



It's a class, so copy the file "ClsActionBar.bas" into your project with Add Existing Module and declare it in Globals with Dim MyActionBar As ClsActionBar.

Did you study how the demo is made ?
I opened the demo up but it wouldn't run. Says refector isnt there or something. So to answer your and erel's questions, yes we do read stuff before asking questions. it's just the people writing stuff are writing for advanced users.
 

barx

Well-Known Member
Licensed User
That's because you are required to use the Reflection Lib.
 

Djembefola

Active Member
Licensed User
yes we do read stuff before asking questions.
After reading some of your posts, i have the impression that you read stuff but never try to understand stuff.
If programming is overstraining and frustrating you, why don't you consider finding another hobby? Cooking, Tap Dance, Synchronized Swimming...there are so many opportunities. ;)
 
Top