Wish [BANano] [SOLVED]- 1.21 Enumeration Initialization Assignments

Discussion in 'B4J Bugs & Wishlist' started by Mashiane, Jan 5, 2019.

  1. Mashiane

    Mashiane Expert Licensed User

    Hi there

    I have defined a class to hold some enumeration values, below is one of them

    'create a COLOR class
    Sub Class_Globals
    Public AMBER As String
    Public BLACK As String
    Public BLUE As String
    Public BLUEGREY As String
    Public BROWN As String
    Public CYAN As String
    Public DEEPORANGE As String
    Public DEEPPURPLE As String
    Public GREEN As String
    Public GREY As String
    Public INDIGO As String
    Public LIGHTBLUE As String
    Public LIGHTGREEN As String
    Public LIME As String
    Public ORANGE As String
    Public PINK As String
    Public PURPLE As String
    Public RED As String
    Public TEAL As String
    Public TRANSPARENT As String
    Public WHITE As String
    Public NORMAL As String
    Public YELLOW As String
    End Sub

    'Initializes COLOR object
    Sub Initialize() As BANanoMaterialColor
        AMBER = 
        BLACK = 
        BLUE = 
        BLUEGREY = 
        BROWN = 
        CYAN = 
        DEEPORANGE = 
        DEEPPURPLE = 
        GREEN = 
        GREY = 
        INDIGO = 
        LIGHTBLUE = 
        LIGHTGREEN = 
        LIME = 
        ORANGE = 
        PINK = 
        PURPLE = 
        RED = 
        TEAL = 
        TRANSPARENT = 
        WHITE = 
        NORMAL = 
        YELLOW = 
    Return Me
    End Sub
    In a master class I have defined..

    Dim EnumColor as BANanoMaterialColor
    However calling

    in the main module writes blank in the console.log. I could be doing this wrongly however assumed that it would work or rather its not assigning the values or something. Please have a peek!

  2. Eme Fibonacci

    Eme Fibonacci Well-Known Member Licensed User

    Hi, it´s works for me.

    'result - green
    Try clean your project.
  3. Eme Fibonacci

    Eme Fibonacci Well-Known Member Licensed User

    Please, why don´t you use this way? (More simple)
    Sub Class_Globals
    Public AMBER As String = "amber"
    'Or Public Const AMBER As String ="amber"
        Public BLACK As String = "black"
    Public BLUE As String = "blue"
    End Sub

    Public Sub Initialize
    End Sub
  4. Mashiane

    Mashiane Expert Licensed User

    For a B4J project it works fine however for a BANano based project its not working yet. I have found a work around but its dirty by assigning the values in Class_Globals.
  5. Mashiane

    Mashiane Expert Licensed User

    The reason is, I want to perhaps do other things on Initialization besides just assigning values but I have also already implemented your suggestion. At times the compiler complains when assigning values in Class_Globals.

    Fact is, due to Initialize is assigning values to the properties, it should work, unless its a design issue inside BANano, if that is the case then, its a learning curve.
  6. alwaysbusy

    alwaysbusy Expert Licensed User

    Mashiane likes this.
  7. Mashiane

    Mashiane Expert Licensed User

    Thank you for the positive response. Please note that as people who are new to BANano we are bound to make mistakes and need all the guidance and help we can get to create beautiful things for both the forum and ourselves. Erel has also on numerous occasions referred people back to their code to fix their own errors, its only natural and you also do the same and thanks for your patience and understanding also, it is very much needed.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice