5

The PowerBuilder documentation states that colors are encoded in a long number between -2 and 16777215.

I quite understand how RGB encodes colors in a long (b*256/256 + g*256 + r), what I don't understand is the meaning of a negative color: What would -1 and -2 mean? I couldn't find anything in the PB documentation that explains negative colors.

Thanks in advance

Laurent
  • 186
  • 2
  • I really don't know, but RGB() returns -1 in case of an error, so it doesn't make sense to let -1 be a legitimate color as well. I wonder if that's a documentation error, where -2 is a non-inclusive lower bound and -1 is the error code. Either way, they are both drawn as white, probably because the R, G and B bytes in them are all set. – Eran Sep 19 '11 at 08:27
  • 1
    PB has special colors such as transparnt, window background, etc, that are beyond the range of max RGB numbers. They can be as large as unsigned long. I thought that the negatives might be overflow on a signed long, but don't think that is what you are talking about. I've worked with PB since 1993 and never seen this question... anyone from Sybase / SAP paying attention? – Rich Bianco Sep 19 '11 at 10:42
  • Which documentation are you looking at? The PB 10.5 docs don't mention negative numbers as an option. – Doug Porter Sep 20 '11 at 22:03
  • @Dougman it's not in the RGB docs but in other places e.g. http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc37787_1150/html/objcont/CJAJBBDJ.htm – Colin Pickard Sep 21 '11 at 18:57

1 Answers1

1

Since we're talking about the backColor for a component, it really looks like a placeholder value to indicate that the control should inherit a color from its parent. That's a guess.

What I can say for certain is that it's not a system color or the "transparent" color:

67108864    ButtonFace
1073741824  WindowBackground
33554432    WindowText
268435456   ApplicationWorkspace
553648127   Transparent

Ultimately, though, I don't think anyone's ever going to hand you that color back from a method, and if you try to use the color for, e.g. drawing, you'd probably throw an error.

Falkreon
  • 598
  • 5
  • 14