Alaska Software Inc. - Colors
Username: Password:
AuthorTopic: Colors
Osvaldo RamirezColors
on Fri, 24 Apr 2020 16:27:19 -0600
Hello guys.

I am lost, Is there a function that show a window with "color selection" ?
and if yes, how can traslate the rgb to html codes ?

Best Regards
Osvaldo Ramirez
Jorge L. BorlandoRe: Colors
on Sat, 25 Apr 2020 11:53:21 -0300
Hi Osvaldo, en gdi32 no has encontrado nada?


"Osvaldo Ramirez" escribió en el mensaje de 
noticias:8c7e6c$285ba3d1$4de87@news.alaska-software.com...

Hello guys.

I am lost, Is there a function that show a window with "color selection" ?
and if yes, how can traslate the rgb to html codes ?

Best Regards
Osvaldo Ramirez
Jorge L. BorlandoRe: Colors
on Sat, 25 Apr 2020 11:55:26 -0300
mira lo publicado jimmy en ot4xb

"Jorge L. Borlando"  escribió en el mensaje de 
noticias:1bb822da$8a88ed1$4e2cf@news.alaska-software.com...

Hi Osvaldo, en gdi32 no has encontrado nada?


"Osvaldo Ramirez" escribió en el mensaje de
noticias:8c7e6c$285ba3d1$4de87@news.alaska-software.com...

Hello guys.

I am lost, Is there a function that show a window with "color selection" ?
and if yes, how can traslate the rgb to html codes ?

Best Regards
Osvaldo Ramirez
Osvaldo RamirezRe: Colors
on Sat, 25 Apr 2020 08:59:07 -0600
On 25/04/20 8:55, Jorge L. Borlando wrote:
> mira lo publicado jimmy en ot4xb
> 
> "Jorge L. Borlando"  escribió en el mensaje de 
> noticias:1bb822da$8a88ed1$4e2cf@news.alaska-software.com...
> 
> Hi Osvaldo, en gdi32 no has encontrado nada?
> 
> 
> "Osvaldo Ramirez" escribió en el mensaje de
> noticias:8c7e6c$285ba3d1$4de87@news.alaska-software.com...
> 
> Hello guys.
> 
> I am lost, Is there a function that show a window with "color selection" ?
> and if yes, how can traslate the rgb to html codes ?
> 
> Best Regards
> Osvaldo Ramirez
Jorge, deja lo busco, gracias. Saludos
Esperando que todo este bien contigo y tu familia.
Jim LeeRe: Colors
on Sat, 25 Apr 2020 19:41:45 +0200
hi,

> I am lost, Is there a function that show a window with "color selection" ?
> and if yes, how can traslate the rgb to html codes ?

try this

#pragma library("XppUi2")
   oColor := XbpColorDialog():New(::drawingArea)

*  oColor:mode := XBPCDLG_MODE_ALLOWCOLOREDIT
   oColor:mode := XBPCDLG_MODE_EDITCOLORS
*  oColor:mode := XBPCDLG_MODE_NOCOLOREDIT

   oColor:title         := "Farbe Auswahl"
   oColor:center        := .T.
   oColor:showHelp      := .F.
   oColor:displayAll    := .T.
   oColor:noDither      := .T.
   oColor:defaultColor  := GraMakeRGBColor(aRGB)
   oColor:Create()






---
Diese E-Mail wurde von AVG auf Viren geprüft.
http://www.avg.com
Osvaldo RamirezRe: Colors
on Sat, 25 Apr 2020 22:21:43 -0600
On 25/04/20 11:41, Jim Lee wrote:
> hi,
> 
>> I am lost, Is there a function that show a window with "color selection" ?
>> and if yes, how can traslate the rgb to html codes ?
> 
> try this
> 
> #pragma library("XppUi2")
>     oColor := XbpColorDialog():New(::drawingArea)
> 
> *  oColor:mode := XBPCDLG_MODE_ALLOWCOLOREDIT
>     oColor:mode := XBPCDLG_MODE_EDITCOLORS
> *  oColor:mode := XBPCDLG_MODE_NOCOLOREDIT
> 
>     oColor:title         := "Farbe Auswahl"
>     oColor:center        := .T.
>     oColor:showHelp      := .F.
>     oColor:displayAll    := .T.
>     oColor:noDither      := .T.
>     oColor:defaultColor  := GraMakeRGBColor(aRGB)
>     oColor:Create()
> 
> 
> 
> 
> 
> 
> ---
> Diese E-Mail wurde von AVG auf Viren geprüft.
> http://www.avg.com
> 
Hello Jim

Thanks a lot for your code.

Best Regards
Osvaldo Ramirez
Andreas Gehrs-Pahl
Re: Colors
on Sat, 25 Apr 2020 20:40:05 -0400
Osvaldo,

>I am lost, Is there a function that show a window with "color selection" ?
>and if yes, how can traslate the rgb to html codes ?

The attached Color Demo Program shows you how to use the (undocumented) 
XbpColorDialog() class and how to create the HTML (and Active-X) color 
values from a selected RGB color value.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC

Color_Demo.zip
Osvaldo RamirezRe: Colors
on Sat, 25 Apr 2020 22:20:50 -0600
On 25/04/20 18:40, Andreas Gehrs-Pahl wrote:
> Osvaldo,
> 
>> I am lost, Is there a function that show a window with "color selection" ?
>> and if yes, how can traslate the rgb to html codes ?
> 
> The attached Color Demo Program shows you how to use the (undocumented)
> XbpColorDialog() class and how to create the HTML (and Active-X) color
> values from a selected RGB color value.
> 
> Hope that helps,
> 
> Andreas
> 
Hello Andreas

Excelent Code!!!, it work on 2.0 and 1.9 too (Except Automationobject())

Thanks a lot,

Best Regards
Osvaldo Ramirez
Andreas Gehrs-Pahl
Re: Colors
on Sun, 26 Apr 2020 02:31:02 -0400
Osvaldo,

>Excelent Code!!!, it work on 2.0 and 1.9 too (Except Automationobject())

Instead of AutomationObject():TranslateColor() you can of course also use 
the original AutomationTranslateColor() function, which will also work in 
older versions, but is now considered deprecated.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Osvaldo RamirezRe: Colors
on Tue, 28 Apr 2020 16:35:02 -0600
On 26/04/20 0:31, Andreas Gehrs-Pahl wrote:
> Osvaldo,
> 
>> Excelent Code!!!, it work on 2.0 and 1.9 too (Except Automationobject())
> 
> Instead of AutomationObject():TranslateColor() you can of course also use
> the original AutomationTranslateColor() function, which will also work in
> older versions, but is now considered deprecated.
> 
> Andreas
> 

Hello Andreas

Is there a function that translte  color number to html, for example:

#define tdBLU      33488896  GRA_CLR_BLUE

So, then how to remake the RGB color ?


Thanks in advance.

Best Regards
Osvaldo Ramirez
Anand GuptaRe: Colors
on Wed, 29 Apr 2020 13:18:17 +0200
Osvaldo Ramirez wrote in message news:30378f52$43c9754$5bd82@news.alaska-software.com...
>
>Hello Andreas
>
>Is there a function that translte  color number to html, for example:
>
>#define tdBLU      33488896  GRA_CLR_BLUE
>
>So, then how to remake the RGB color ?
>
>
>Thanks in advance.
>
>Best Regards
>Osvaldo Ramirez

Use tdRGB(tdBLU)

From Topdown help

This example shows tdRGB() being used to extract an RGB array from a color value

    aRgb := tdRGB(nColor)

Regards,

Anand
Osvaldo RamirezRe: Colors
on Wed, 29 Apr 2020 08:36:55 -0600
On 29/04/20 5:18, Anand Gupta wrote:
> Osvaldo Ramirez wrote in message news:30378f52$43c9754$5bd82@news.alaska-software.com...
>>
>> Hello Andreas
>>
>> Is there a function that translte  color number to html, for example:
>>
>> #define tdBLU      33488896  GRA_CLR_BLUE
>>
>> So, then how to remake the RGB color ?
>>
>>
>> Thanks in advance.
>>
>> Best Regards
>> Osvaldo Ramirez
> 
> Use tdRGB(tdBLU)
> 
>  From Topdown help
> 
> This example shows tdRGB() being used to extract an RGB array from a color value
> 
>      aRgb := tdRGB(nColor)
> 
> Regards,
> 
> Anand
> 
Thansk Anand
Let me try

Best Regards
Osvaldo Ramirez
Osvaldo RamirezRe: Colors
on Wed, 29 Apr 2020 08:42:25 -0600
On 29/04/20 5:18, Anand Gupta wrote:
> Osvaldo Ramirez wrote in message news:30378f52$43c9754$5bd82@news.alaska-software.com...
>>
>> Hello Andreas
>>
>> Is there a function that translte  color number to html, for example:
>>
>> #define tdBLU      33488896  GRA_CLR_BLUE
>>
>> So, then how to remake the RGB color ?
>>
>>
>> Thanks in advance.
>>
>> Best Regards
>> Osvaldo Ramirez
> 
> Use tdRGB(tdBLU)
> 
>  From Topdown help
> 
> This example shows tdRGB() being used to extract an RGB array from a color value
> 
>      aRgb := tdRGB(nColor)
> 
> Regards,
> 
> Anand
> 
Hello Anand
I have topdown, but Is it correct ?

FUNCTION tdRGB(aArray)
RETURN graMakeRGBcolor(aArray)

or maybe it has changed.

Best Regards
Osvaldo Ramirez
Anand GuptaRe: Colors
on Thu, 30 Apr 2020 15:27:59 +0200
Osvaldo Ramirez wrote in message news:3375fabb$403d5fac$5d943@news.alaska-software.com...
>On 29/04/20 5:18, Anand Gupta wrote:
>> Osvaldo Ramirez wrote in message news:30378f52$43c9754$5bd82@news.alaska-software.com...
>>>
>>> Hello Andreas
>>>
>>> Is there a function that translte  color number to html, for example:
>>>
>>> #define tdBLU      33488896  GRA_CLR_BLUE
>>>
>>> So, then how to remake the RGB color ?
>>>
>>>
>>> Thanks in advance.
>>>
>>> Best Regards
>>> Osvaldo Ramirez
>> 
>> Use tdRGB(tdBLU)
>> 
>>  From Topdown help
>> 
>> This example shows tdRGB() being used to extract an RGB array from a color value
>> 
>>      aRgb := tdRGB(nColor)
>> 
>> Regards,
>> 
>> Anand
>> 
>Hello Anand
>I have topdown, but Is it correct ?
>
>FUNCTION tdRGB(aArray)
>RETURN graMakeRGBcolor(aArray)
>
>or maybe it has changed.
>
>Best Regards
>Osvaldo Ramirez

From TopDown help file,

tdRGB() function

Program file:  tdWork1.prg

Syntax:

tdRGB(xValue)

Arguments

xValue - Can be one of two things:

   1) an array containing three elements that are numeric values indicating 
     the intensity of the colors red, green, and blue. The intensity of each 
     of these colors is defined by integer values between 0 and 255. 
    2) a valid numeric color value that can be broken down into three RGB values.
                              If this is one of the Xbase++ system colors, such as GRA_CLR_RED,
         it will first be translated into an RGB color value, so it will still return an 
         RGB array.
Returns

If xValue is an array of valid RGB values, returns a numeric value made from the RGB array.

If xValue is a valid numeric color value, returns an array of three RGB values that make up the color.

Returns NIL if an illegal parameter is passed.

Description

tdRGB() is a wrapper function for the Xbase++ functions GraMakeRGBcolor(), GraGetRGBIntensity() and TranslateSysColor().  Its sole purpose is to make using these functions more convenient by being quicker to type and easier to remember.  It adds no additional functionality.

Depending on the value sent in, the function either creates a numeric color value from an array of RGB values, or breaks down a numeric color value into an array of RGB values.

Examples

This example shows tdRGB() being used to create a numeric color value from an array of RGB values
    nColor := tdRGB({244,242,193})


This example shows tdRGB() being used to extract an RGB array from a color value
    aRgb := tdRGB(nColor)
 


so may be yours is old. You can get the latest in this forum itself now.

Regards,

Anand
Osvaldo RamirezRe: Colors
on Thu, 30 Apr 2020 20:04:17 -0600
On 30/04/20 7:27, Anand Gupta wrote:
> Osvaldo Ramirez wrote in message news:3375fabb$403d5fac$5d943@news.alaska-software.com...
>> On 29/04/20 5:18, Anand Gupta wrote:
>>> Osvaldo Ramirez wrote in message news:30378f52$43c9754$5bd82@news.alaska-software.com...
>>>>
>>>> Hello Andreas
>>>>
>>>> Is there a function that translte  color number to html, for example:
>>>>
>>>> #define tdBLU      33488896  GRA_CLR_BLUE
>>>>
>>>> So, then how to remake the RGB color ?
>>>>
>>>>
>>>> Thanks in advance.
>>>>
>>>> Best Regards
>>>> Osvaldo Ramirez
>>>
>>> Use tdRGB(tdBLU)
>>>
>>>   From Topdown help
>>>
>>> This example shows tdRGB() being used to extract an RGB array from a color value
>>>
>>>       aRgb := tdRGB(nColor)
>>>
>>> Regards,
>>>
>>> Anand
>>>
>> Hello Anand
>> I have topdown, but Is it correct ?
>>
>> FUNCTION tdRGB(aArray)
>> RETURN graMakeRGBcolor(aArray)
>>
>> or maybe it has changed.
>>
>> Best Regards
>> Osvaldo Ramirez
> 
>  From TopDown help file,
> 
> tdRGB() function
> 
> Program file:  tdWork1.prg
> 
> Syntax:
> 
> tdRGB(xValue)
> 
> Arguments
> 
> xValue - Can be one of two things:
> 
>     1) an array containing three elements that are numeric values indicating
>       the intensity of the colors red, green, and blue. The intensity of each
>       of these colors is defined by integer values between 0 and 255.
>      2) a valid numeric color value that can be broken down into three RGB values.
>                                If this is one of the Xbase++ system colors, such as GRA_CLR_RED,
>           it will first be translated into an RGB color value, so it will still return an
>           RGB array.
> Returns
> 
> If xValue is an array of valid RGB values, returns a numeric value made from the RGB array.
> 
> If xValue is a valid numeric color value, returns an array of three RGB values that make up the color.
> 
> Returns NIL if an illegal parameter is passed.
> 
> Description
> 
> tdRGB() is a wrapper function for the Xbase++ functions GraMakeRGBcolor(), GraGetRGBIntensity() and TranslateSysColor().  Its sole purpose is to make using these functions more convenient by being quicker to type and easier to remember.  It adds no additional functionality.
> 
> Depending on the value sent in, the function either creates a numeric color value from an array of RGB values, or breaks down a numeric color value into an array of RGB values.
> 
> Examples
> 
> This example shows tdRGB() being used to create a numeric color value from an array of RGB values
>      nColor := tdRGB({244,242,193})
> 
> 
> This example shows tdRGB() being used to extract an RGB array from a color value
>      aRgb := tdRGB(nColor)
>   
> 
> 
> so may be yours is old. You can get the latest in this forum itself now.
> 
> Regards,
> 
> Anand
> 
Thanks Anand, you are right, my code its old.
Best Regards
Osvaldo Ramirez
Andreas Gehrs-Pahl
Re: Colors
on Wed, 29 Apr 2020 12:24:33 -0400
Osvaldo,

>Is there a function that translte  color number to html, for example:

>#define tdBLU      33488896  GRA_CLR_BLUE

>So, then how to remake the RGB color ?

To convert Xbase++ (and System) Color Constants to RGB values, you can use: 
AutomationTranslateColor(AutomationTranslateColor(nConstant, .f.), .t.)

This will handle explicit Xbase++ Graphic color constants like GRA_CLR_*,
as well as (Windows) System color constants, like the XBPSYSCLR_* values
which are negative.

There are basically three different color value types in Xbase++. They all 
are in the format: 0x0nBBGGRR, where "n" is 0 for the COLORREF structure, 
which is used by the Windows API Functions such as GetSysColor() and 
SetSysColors(), while GraMakeRGBColor() and GraGetRGBIntensity() use a 
value of 1 for "n". Finally, AutomationObject():TranslateColor() -- and the 
AutomationTranslateColor() function -- uses a value of 2 for "n" and can 
also convert between the "n" values of 0, 1, and 2, when setting the second 
parameter <lIsOLEColor> to TRUE.

After you have a color in the 0x01BBGGRR format, you can use the Xbase++ 
function  GraGetRGBIntensity() to get an array in the {RR, GG, BB} format, 
which you can then convert into an HTML #RRGGBB constant, just as the demo 
program does.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Osvaldo RamirezRe: Colors
on Wed, 29 Apr 2020 16:17:43 -0600
On 29/04/20 10:24, Andreas Gehrs-Pahl wrote:
> Osvaldo,
> 
>> Is there a function that translte  color number to html, for example:
> 
>> #define tdBLU      33488896  GRA_CLR_BLUE
> 
>> So, then how to remake the RGB color ?
> 
> To convert Xbase++ (and System) Color Constants to RGB values, you can use:
> AutomationTranslateColor(AutomationTranslateColor(nConstant, .f.), .t.)
> 
> This will handle explicit Xbase++ Graphic color constants like GRA_CLR_*,
> as well as (Windows) System color constants, like the XBPSYSCLR_* values
> which are negative.
> 
> There are basically three different color value types in Xbase++. They all
> are in the format: 0x0nBBGGRR, where "n" is 0 for the COLORREF structure,
> which is used by the Windows API Functions such as GetSysColor() and
> SetSysColors(), while GraMakeRGBColor() and GraGetRGBIntensity() use a
> value of 1 for "n". Finally, AutomationObject():TranslateColor() -- and the
> AutomationTranslateColor() function -- uses a value of 2 for "n" and can
> also convert between the "n" values of 0, 1, and 2, when setting the second
> parameter <lIsOLEColor> to TRUE.
> 
> After you have a color in the 0x01BBGGRR format, you can use the Xbase++
> function  GraGetRGBIntensity() to get an array in the {RR, GG, BB} format,
> which you can then convert into an HTML #RRGGBB constant, just as the demo
> program does.
> 
> Hope that helps,
> 
> Andreas
> 

As always, thanks for your valuable help

Best Regards
Osvaldo Ramirez