xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

GetPairPos()

Returns the absolute position of a color value in a color string.

Syntax

GetPairPos( <cColorString>, <nPos> ) --> nAbsPos

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 find in <cColorString>. The first color value in the color string has the ordinal position 1.

Return

The function returns the absolute position of the color value at the ordinal position <nPos> in the passed color string as a numeric value.

Info

Category: Screen functions
Source:rtl\color53.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example uses function SubStr() to extract a color
// value from a color string

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

      nAbsPos := GetPairPos( cColor, 6 )
      nLength := GetPairLen( cColor, 6 )

      ? SubStr( cColor, nAbsPos, nLength )  // result: W+/B

      ? GetClrPair( cColor, 6 )             // result: W+/B
   RETURN

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