Issue with onSelect Event in WebColorPicker Component

Dear Support Team,

I am currently using a WebColorPicker component in my project. I have set up an onSelect event to handle color selections. The expected behavior is to receive the color in TColor format, which I then convert to a hexadecimal format and paste into a memo field.

However, I've encountered an issue where the onSelect event does not seem to trigger when a color is selected. This is preventing the color content from being processed and displayed as intended.

Could you please assist me in resolving this issue?

Here demo code i tested this.
WebColorPickerEventError.zip (7.6 KB)

Best regards

Your code is wrong.
The parameter of your TColorToHex is AColor , so you should use AColor in your GetRValue() etc... calls

Your wrong code:

function TForm3.TColorToHex(AColor: TColor): String;
begin


   Result :=
    { red value }
    IntToHex( GetRValue( Color ), 2 ) +
    { green value }
    IntToHex( GetGValue( Color ), 2 ) +
    { blue value }
    IntToHex( GetBValue( Color ), 2 );
end;

The correct code:

function TForm3.TColorToHex(AColor: TColor): String;
begin


   Result :=
    { red value }
    IntToHex( GetRValue( AColor ), 2 ) +
    { green value }
    IntToHex( GetGValue( AColor ), 2 ) +
    { blue value }
    IntToHex( GetBValue( AColor ), 2 );
end;

Dear Support Team,

Thank you for acknowledging the issue with the onSelect event in the WebColorPicker component. Your prompt attention to this matter is greatly appreciated.

In the meantime, I have encountered another issue. I am unable to bind the WebColorPicker component to a specific element ID in my project. This binding issue is hindering the integration of the component into my application.

Could you please provide guidance or a solution to resolve this binding problem as well?

Thank you once again for your support and assistance.

Test Demo:
WebColorPickerError.zip (10.9 KB)

Best regards.

The documentation page 179

clearly shows the HTML to bind to, i.e.
<INPUT TYPE=”COLOR” ID=”UniqueID”>
and I see you just try to bind to a DIV.
So, please use the correct HTML element to bind to.

Dear Bruno Fierens,

Thank you once again for your support and assistance.At this link (i reached throught right-click to component and online help item click)

Link

it says

Because of that i used div element.

Best regards.

We will need to correct this online doc.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.