FORECOLOR property

All controls.

Returns or sets the foreground color of the specified control.

foregroundcolor = Get_Property(objectname, "FORECOLOR")

existingprop = Set_Property(objectname, "FORECOLOR", color)

Values passed in Set_Property:

ValueDescription
ColorNew color value.

The intensity for each argument can range from 0 through 255. If all three intensities are set to zero, the result is black. If all three intensities are set at 255, the result is white.

For BASIC+, the formula for color value is:

color = red + (green * 256) + (blue * 65536)

For child window control, FORECOLOR 0 sets the background color to the default. To make the child window foreground black, pass color = 1

Values returned by both Get_Property and Set_Property:

ValueDescription
foregroundcolorForeground color value of specified control.
existingpropForeground color value, when Set_Property was called. That is, the value before it was changed.

Example 1: sets the color for CtrlEntID

Color  = Get_Property(CtrlEntID, "FORECOLOR")

Parent = CtrlEntID [1,"."]

Color  = Utility("CHOOSECOLOR", Parent, Color)

if len(Color) then

  Set_Property(CtrlEntID, "FORECOLOR", Color)

end

Example 2: convert between an @vm-delimited RGB value (used by QuickHelp and Msg, for example) and a Color value (the FORECOLOR and BACKCOLOR property values)

* convert from RGB to Color

Color = RGB<1,1> + RGB<1,2> * 256 + RGB<1,3> * 65536

* convert from Color to RGB

RGB   = ""

Temp  = Color        ;* don't modify the Color value

for i = 1 to 3

  RGB<1,i> = mod(Temp, 256)

  Temp     = int(Temp / 256)

next I
 
 
  • guides/programming/programmers_reference_manual/forecolor.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1