xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

SetClrPair()

Replaces a color value in a color string.

Syntax

SetClrPair( <cColorString>, <nPos>, <cColor> ) --> cNewColorString

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.
<cColor>
A character string holding a color value consisting of foreground and background color.

Return

The function replaces the color at the ordinal position <nPos> with <cColor> and returns the modified color string. If <cColorString> has less than <nPos> colors, the return value is a null string ("").

Info

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

Example

// The example demonstrates how a color value can be
// replaced in a color string.

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

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

      cColor := SetClrPair( cColor, 6, "BG+/R" )

      ? GetClrPair( cColor, 6 )             // result: BG+/R

   RETURN

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