[futurebasic] Re: [FB] Color picker

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2008 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Mon, 29 Sep 2008 19:27:18 -0400
Here's what I use, approach wise, from some old code cobbled up ages  
ago (2001). The WherePt seems useless these days.

CLEAR LOCAL
LOCAL FN RCColorPicker(which as int)
'---> Variables
DIM rgbIn as RGBColor

DIM WherePt as POINT
DIM Msg$
dim as int Picked

Select which
case 0
rgbIn.red   = gTargetColor.red
rgbIn.green = gTargetColor.green
rgbIn.blue  = gTargetColor.blue
case 1
rgbIn.red   = gReplaceColor.red
rgbIn.green = gReplaceColor.green
rgbIn.blue  = gReplaceColor.blue
End Select
'---> Pick Color

WherePt.h% = 50
WherePt.v% = 50

Long if which
Msg$       = "Pick replacement color."
Xelse
Msg$       = "Pick target color."
End If

Picked    = FN GetColor (WherePt, Msg$, rgbIn, gRGBOut)

END FN = Picked


On Sep 29, 2008, at 6:18 PM, Pierre Zippi wrote:

> This code used to work in FBII and half works in FB4. I suspect it is
> in the way the vars are dimmed, but what do I know? I've been brute
> force trial and erroring and now it's time to ask the list.
>
> CLEAR LOCAL
> DIM Ypt,Xpt,32 Prompt$
> DIM RGB.6
> DIM RGBin.6
> LOCAL FN getLongColor
>   Ypt=0 : Xpt=0
>   RGBin.red%=red&            'current color in
>   RGBin.green%=green&
>   RGBin.blue%=blue&
>   Prompt$="Select a color
>   result%=FN GETCOLOR(Ypt,Prompt$,RGBin,VARPTR(RGB))
>   LONG IF result%<>0
>     red&=VAL(UNS$(RGB.red%))
>     green&=VAL(UNS$(RGB.green%))
>     blue&=VAL(UNS$(RGB.blue%))
>     ColorSets&(CurDataSet%,1)=red&
>     ColorSets&(CurDataSet%,2)=green&
>     ColorSets&(CurDataSet%,3)=blue&
>   XELSE
>     'canceled
>   END IF
> END FN
>
> --
> To unsubscribe, send ANY message to: futurebasic- 
> unsubscribe@...
>