xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_ColorIndex()

Extracts a color value from a color string.

Syntax

HB_ColorIndex( <cColorString>, <nColorIndex> ) --> cColorValue

Arguments

<cColorString>
This is a SetColor() compliant character string holding color values as a comma separated list.
<nColorIndex>
A numeric value identifying the ordinal position of a color value in the color string. <nColorIndex>is zero based, i.e. the first color value has the ordinal position 0.

Return

The function returns the color value at position <nPos> in the passed color string as a character string. If <cColorString> has less than <nPos>+1 colors, the return value is a null string ("").

Description

The function HB_ColorIndex() extracts a color value from <cColorString>. Constants from the COLOR.CH file can be used to address a specific color value:

#define constants for HB_ColorIndex()
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

Info

See also:ColorSelect(), GetClrPair(), SetClrPair(), SetColor()
Category: Screen functions , xHarbour extensions
Header:color.ch
Source:rtl\colorind.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates return values of HB_ColorIndex()

   #include "Color.ch"

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

      SetColor( cColor )

      ? HB_ColorIndex( cColor, CLR_STANDARD )    // result: N/W
      ? HB_ColorIndex( cColor, CLR_ENHANCED )    // result: W+/N
      ? HB_ColorIndex( cColor, CLR_BORDER )      // result: W+/W
      ? HB_ColorIndex( cColor, CLR_BACKGROUND )  // result: W+/B
      ? HB_ColorIndex( cColor, CLR_UNSELECTED )  // result: GR+/B
   RETURN

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