Bug ??? set global property or constant to RGBA

  1. 5 months ago

    Arthur G

    Feb 3 Pre-Release Testers

    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

    App.CRghtColr Declaration
    Not enough arguments: got 0, expected 4.
    Shared CRghtColr As Color = Color.RGBA(000, 061, 255, 208)

    For the computed property, the value for get that shows in the top is

    &c00000000

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

    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?

  2. Arthur G

    Feb 3 Pre-Release Testers

    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.

  3. Dave S

    Feb 3 San Diego, California USA
    Public Const kCRghtColr as Color = &c003dffd0
  4. Arthur G

    Feb 3 Pre-Release Testers

    Thanks Dave.
    Yup. Figured that out. Now for preventing the error

  5. Julian S

    Feb 3 Pre-Release Testers, Xojo Pro UK

    @Arthur G Now for preventing the error

    Change Shared to Dim

    Dim CRghtColr As Color = Color.RGBA(000, 061, 255, 208)

  6. Arthur G

    Feb 3 Pre-Release Testers

    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

    App.OpenPrefs, line 8
    Syntax error
    Global CRghtColr As Color = Color.RGBA(000, 061, 255, 208)

  7. Dave S

    Feb 3 San Diego, California USA

    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

  8. Julian S

    Feb 3 Pre-Release Testers, Xojo Pro UK
    Edited 5 months ago

    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.

  9. Greg O

    Feb 3 Xojo Inc Somewhere near Raleigh, NC

    @Julian S 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.

    Or a method if you want it to be Read Only.

  10. Arthur G

    Feb 3 Pre-Release Testers

    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.

    MnStuff.CRghtCol Declaration
    Syntax error
    CRghtCol As Color = 000,061,255,208

  11. Julian S

    Feb 3 Pre-Release Testers, Xojo Pro UK

    Here you go Arthur:

    https://www.dropbox.com/s/85oesro0ccpb2my/GlobalColor.mp4?raw=1

  12. Arthur G

    Feb 3 Pre-Release Testers

    Oh. You don't give it values. I can do that? That's easy.

    Why can't I put values in?

  13. Julian S

    Feb 3 Pre-Release Testers, Xojo Pro UK
    Edited 5 months ago

    If you do this:

    -image-

    Then you can give the color a default value.

  14. Arthur G

    Feb 3 Pre-Release Testers
    Edited 5 months ago

    Could this be a bug?
    I wonder what is different. I use the current version on a Mac.

  15. Arthur G

    Feb 3 Pre-Release Testers
    Edited 5 months ago

    Could this be a XOJO bug?

    Without
    -image-

    With Default Value
    -image-

    Error message for With

    MnStuff.CRghtColr Declaration
    Syntax error
    CRghtColr As Color = #c003dffd0

  16. Alberto D

    Feb 3 Pre-Release Testers, Xojo Pro Answer
    Edited 5 months ago

    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?

  17. Dave S

    Feb 3 San Diego, California USA

    &C is the color designator,, not #C as has been mentioned numerous times in this topic

  18. Arthur G

    Feb 3 Pre-Release Testers

    I am not embarrassed, but thank you for pointing the error.
    If you look up on the internet

    #ff0000

    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:

    1. XOJO uses different symbols.
    2. The analyzer didn't point out the expected format for a color.
  19. Julian S

    Feb 3 Pre-Release Testers, Xojo Pro UK

    Arthur, I wouldn't suggest going on the rest of the internet to find syntax for Xojo command. Check:

    http://developer.xojo.com/color

    for all the information you need on Color and keep http://developer.xojo.com/ as a goto site for Xojo reference information.

  20. Tim H

    Feb 4 Pre-Release Testers Portland, OR USA

    @Arthur G If you look up on the internet

    #ff0000

    you will find infinite (almost) references to hex value and red.

    That's HTML syntax, not Xojo. Different language, different syntax.

or Sign Up to reply!