"Constants" and Libraries

raytronixsystems

Active Member
Licensed User
Longtime User
I'm about to install the new B4A 2.50 Beta which can create libraries and had the following question:

If I had a class defined within a library that defined public Constants could they be referenced once they are compiled within a library? I'm thinking that an external Code Module might be best but I'm not sure at this time.

Any guidance would be appreciated.
Regards,
Ray

example here:

main activity (main.bas):
B4X:
'
'
'


Sub Activity _Create (FirstTime As Boolean)
Dim tl As testlib
tl.initialize("")

Dim Height As Int              ' height...
Dim Width As Int               ' width...
Dim  Radius As Int             ' corner radius...

Height = tl.ACTIONBAR_HEIGHT                  ' set the height...
Width = tl.ACTIONBAR_Width                     ' set the width...
Radius = tl.ACTIONBAR_CORNER_RADIUS      ' set the corner radius...
'
more code here...
'
' 
'
End Sub

B4X:
Class code in testlib.bas library:
[code]
Sub Class_Globals
   Private dummyView As View             ' make Activity             
   '
   ' Constants defined here:
   '
   Public ACTIONBAR_HEIGHT As Int = 50dip                              'Action Bar Height
   Public ACTIONBAR_WIDTH As Int = 100%x                              'Action Bar Width
   Public ACTIONBAR_CORNER_RADIUS As Int = 7dip                         'Action Bar Corner Radius if requested

' Additional class code here: ....
'
'
' End of Subroutine Class Globals
'

End Sub
 
Top