Windows color dialog box

Hello

A suggestion for update, will be to add a function to open windows color dialogbox because the html5 tag doesn’t work with chromium.

Thank-you !

Why not? It may be possible to include this dialog box. However, we’ll have to find out how.

1 Like

Maybe that link help :
TColorDialog.Execute Method

Or this other one :
https://www.youtube.com/watch?v=mTuckySrmbc

There is this color palette, I do not know if it will help you.
uses jquery.
PickColor

Good luck.

Yes, thank you, I have tested that script before and it does’n work with ExeOutPut, on myside …

I use http://jscolor.com/ for most all projects now.

You can download for free and even use in opensource projects, but very small one time fee for commercial projects.

Thank-you, this is to what I have been using until now, but using the windows color box will be more acurate !

I have to agree with you on on the accurate statement. Never got windows dialog box to work so got lazy and just used jscolor : )

1 Like

Hi,

In last version, I have tested :

procedure StartIt;

var

CD: TColorDialog;

S: String;

begin

CD := TColorDialog.Create(nil);

CD.Execute(0);

S := inttostr(CD.Color);

ShowMessage(S);

CD.Free;

end;

But the answer is :
Unknown identifier or variable is not declared “TColorDialog”:

Gilbert

It is okay now, I just forgot to add “uses Dialogs” on top …

Now the problem is, how can I php echo the code ?

I mean I obtain the code with ShowMessage(S), but If I use Result := S it only shows the number 1…

You could store the result into a global variable:

procedure StartIt;

var

CD: TColorDialog;

S: String;

begin

CD := TColorDialog.Create(nil);

CD.Execute(0);

S := inttostr(CD.Color);

SetGlobalVar(“colorchoice”, S, false);

CD.Free;

end;

Then, you can get the value with PHP:

echo exo_getglobalvariable('colorchoice', '');

Good, it is working !

Now, how can I get the hex color value that way ?

Thank-you,

Ok. I have it, in php :

function fromRGB($R, $G, $B)
{

$R = dechex($R);
if (strlen($R)<2)
$R = '0'.$R;

$G = dechex($G);
if (strlen($G)<2)
$G = '0'.$G;

$B = dechex($B);
if (strlen($B)<2)
$B = '0'.$B;

return '#' . $R . $G . $B;

}

Then :

$color = exo_runhescriptcom(‘MainUser.StartIt’);
$result = exo_getglobalvariable(‘colorchoice’, ‘’);
echo fromRGB($result,“”,“”);