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...