xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

GetClrPair()

Extracts a color value from a color string.

Syntax

GetClrPair( <cColorString>, <nPos> ) --> cColorValue

Arguments

<cColorString>
This is a SetColor() compliant character string holding color values as a comma separated list.
<nPos>
This numeric value specifies the ordinal position of the color value to extract from <cColorString>. The first color value in the color string has the ordinal position 1.

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> colors, the return value is a null string ("").

Info

See also:GetPairLen(), GetPairPos(), SetClrPair(), SetColor()
Category: Screen functions
Source:rtl\color53.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example extracts all color values from a color
// string holding eight color values.

   PROCEDURE Main
      LOCAL i, cColor := "W/R,W/G,W/B,W+/R,W+/G,W+/B,W/BG,W+/BG"

      FOR i:=1 TO 8
         ? GetClrPair( cColor, i )
      NEXT

      ** output
      // W/R
      // W/G
      // W/B
      // W+/R
      // W+/G
      // W+/B
      // W/BG
      // W+/BG
   RETURN

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