I tried experimenting with XOJO color and specifically RGBA to get a property, computed property, or constant.
I get some interesting analyzer errors.
For the constant [quote]App.CRghtColr Declaration
Not enough arguments: got 0, expected 4.
Shared CRghtColr As Color = Color.RGBA(000, 061, 255, 208)[/quote]
For the computed property, the value for get that shows in the top is [quote]&c00000000[/quote].
That is promising but I can’t find a converter of RGBA to hex. I have tried several.
I have tried to find posts that explain, but I can’t find “RGBA property” mentions. It usually shows RGB.
I figured out how to get a full hex value but now I have another error: Syntax error.
Public Const kCRghtColr as Color = #c003dffd0
I don’t understand.
Public Const kCRghtColr as Color = &c003dffd0
Yup. Figured that out. Now for preventing the error
Change Shared to Dim
Dim CRghtColr As Color = Color.RGBA(000, 061, 255, 208)
How do I make it global. Like adding adding a property via the IDE.
I tried this code in an App method
Global CRghtColr As Color = Color.RGBA(000, 061, 255, 208)
I get another syntax error
[quote]App.OpenPrefs, line 8
Global CRghtColr As Color = Color.RGBA(000, 061, 255, 208)[/quote]
And where did you find that syntax? (and the use of “#” for that matter)
Checking the LangRef might save you posting questions with improper use of syntax
I don’t believe that you can declare a global like that.
The easiest way is to create a module then add a property to that module. That property will then be global across your project.
[quote=372148:@JulianS]I don’t believe that you can declare a global like that.
The easiest way is to create a module then add a property to that module. That property will then be global across your project.[/quote]
Or a method if you want it to be Read Only.
I get errors if I try to declare an RGBA property. I can’t figure it out. I’ve tried it without parentheses and still some error.
CRghtCol As Color = 000,061,255,208[/quote]
Oh. You don’t give it values. I can do that? That’s easy.
Why can’t I put values in?
If you do this:
Then you can give the color a default value.
Could this be a bug?
I wonder what is different. I use the current version on a Mac.
Could this be a XOJO bug?
With Default Value
Error message for With
CRghtColr As Color = #c003dffd0[/quote]
You are using # while others in this thread are using &.
I haven’t learn about colors and it’s values, but I guess that could be the problem. Or maybe it needs 4 pairs (8 total after #) and you have 9?
&C is the color designator, not #C as has been mentioned numerous times in this topic
I am not embarrassed, but thank you for pointing the error.
If you look up on the internet [quote]#ff0000[/quote] you will find infinite (almost) references to hex value and red.
If you then replace the # with an & the same sites will show up.
I copied the hex value above from w3schoolslink text.com where they represent and apparently most of the internet also represent hex colors with a #. XOJO uses an &
My problem of this bug is solved in that:
- XOJO uses different symbols.
- The analyzer didn’t point out the expected format for a color.
Arthur, I wouldn’t suggest going on the rest of the internet to find syntax for Xojo command. Check:
for all the information you need on Color and keep http://developer.xojo.com/ as a goto site for Xojo reference information.
[quote=372171:@Arthur Gabhart]If you look up on the internet
you will find infinite (almost) references to hex value and red.[/quote]
That’s HTML syntax, not Xojo. Different language, different syntax.