B4J Question Paint fail to initialise ?

Discussion in 'B4J Questions' started by hookshy, Jul 16, 2015.

  1. hookshy

    hookshy Well-Known Member Licensed User

    I have a process variable
    Code:
    dim pipecolor as paint    pipecolor= fx.Colors.Blue
    and I face sometimes the problem when using its variable like
    object should be first initialised paint ...on this line :
    lbl(newindex).TextColor=pipecolor

    when I try to fix this with :

    Code:
    If pipecolor.IsInitialized=False Then
        pipecolor=fx.Colors.Blue
    End If
    I get null pointer exception error ...

    How should I handle this paint object to skip initialisation errors ?
     
  2. Roycefer

    Roycefer Well-Known Member Licensed User

    I've run into that problem, too. I think the best solution is to store your "color" variables as Ints, as follows:
    Code:
    Dim pipecolor As Int = fx.Colors.To32Bit(fx.Colors.Blue)
    and then when you want to set a color of something, use:
    Code:
    fx.Colors.From32Bit(pipecolor)
     
  3. hookshy

    hookshy Well-Known Member Licensed User

    Sometimes it feels like I have to pass the see :rolleyes: , but thanks guys ...when did you had time to learn so much
    Thank you
     
Loading...
  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