xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

ColorSelect()

Selects a color from the current SetColor() string.

Syntax

ColorSelect( <nColorIndex> ) --> NIL

Arguments

<nColorIndex>
A numeric value identifying the ordinal position of a color value in the SetColor() string. <nColorIndex>is zero based, i.e. the first color value has the ordinal position 0.

Return

The return value is always NIL.

Description

The function ColorSelect() selects a color value from the current SetColor() string for standard console output. ColorSelect() does not change the SetColor() string. Constants from the COLOR.CH file can be used to address a specific color value:

#defined constants for ColorSelect()
ConstantValueDescription
CLR_STANDARD0All screen output commands and functions
CLR_ENHANCED1GETs and selection highlights
CLR_BORDER2Screen border (not supported on EGA and VGA monitors)
CLR_BACKGROUND3Not supported
CLR_UNSELECTED4Unselected GETs

If the SetColor() string contains more than five color values, other colors can be selected by passing a value > 4 to the function.

Info

See also:SET COLOR, SetBlink(), SetColor()
Category: Screen functions
Header:color.ch
Source:rtl\setcolor.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates changing of colors for the ? command.

   #include "Color.ch"

   PROCEDURE Main
      LOCAL cColor := SetColor( "N/W,W+/N,W+/W,W+/B,GR+/B" )

      ? "SetColor():", SetColor()
      ?
      ? "ColorSelect( CLR_STANDARD )"

         ColorSelect( CLR_ENHANCED )
      ? "ColorSelect( CLR_ENHANCED )"

         ColorSelect( CLR_BORDER )
      ? "ColorSelect( CLR_BORDER )"

         ColorSelect( 3 )
      ? "ColorSelect( CLR_BACKGROUND )"

         ColorSelect( 4 )
      ? "ColorSelect( CLR_UNSELECTED )"

      ColorSelect( 0 )

      ? "Back to standard color"
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe