Bug? Compare colors

Status
Not open for further replies.

Yunus ÖZ

Member
Licensed User
I try to change alpha channel for Panel, and i wrote a code below

B4X:
If SurfaceHolder.Color=Colors.ARGB(0,255,255,255) Then '<--- Line: 107
     SurfaceHolder.SetColorAnimated(666,Colors.ARGB(0,255,255,255),Colors.ARGB(255,255,255,255))
Else
     SurfaceHolder.SetColorAnimated(666,Colors.ARGB(255,255,255,255),Colors.ARGB(0,255,255,255))
End If
When i hit "F5" IDE say me that

B4A version: 5.50
Parsing code. (0.01s)
Compiling code. Error
Error compiling program.
Error description: Property: Color is writeonly.
Occurred on line: 107
If SurfaceHolder.Color=Colors.ARGB(0,255,255,255) Then
Word: color

Thank you
Best regards
 
Last edited:

Yunus ÖZ

Member
Licensed User
Please use [code]code here...[/code] tags when posting code.

This is not a bug. The color property is writeonly.
Thank you for reply and i edited

Yes i know it is readonly but i dont add a new value, i want to compare
it is in "IF block",
 

Yunus ÖZ

Member
Licensed User
Thank you, i wonder that,
if a variable writable, why not readable

Forgive me if I was rude :(

Thank you again
Best regards.
 

ArminKH

Well-Known Member
I can explain. But questions should be posted in the questions forum...
some thing like this
B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals

End Sub

Sub Globals
    Dim SurfaceHolder As Panel
    Dim SurfaceHolderColor As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Public Sub setSurfaceHolderColor(color As Int)
    SurfaceHolder.Color = color
    SurfaceHolderColor  = color
End Sub


Public Sub YourSubName
    If SurfaceHolderColor = Colors.ARGB(0,255,255,255) Then
        SurfaceHolder.SetColorAnimated(666,Colors.ARGB(0,255,255,255),Colors.ARGB(255,255,255,255))
        SurfaceHolderColor = Colors.ARGB(255,255,255,255)
    Else
        SurfaceHolder.SetColorAnimated(666,Colors.ARGB(255,255,255,255),Colors.ARGB(0,255,255,255))
        SurfaceHolderColor = Colors.ARGB(0,255,255,255)
    End If
End Sub

also can use tag property to store panel's color
 
Last edited:
Status
Not open for further replies.
Top