Jump to content

TUniColorPalette Color


dkeene

Recommended Posts

Hi

THis is hopefully simple question, but I understand clicking a color on the palette sets the Color property of the TUniColorPalette. However, shouldn't setting the Color Property, if the color exists on the palette, show that color selected with a box around it? Am I doing something wrong?

Thanks

Doug

Link to comment
Share on other sites

52 minutes ago, dkeene said:

THis is hopefully simple question, but I understand clicking a color on the palette sets the Color property of the TUniColorPalette. However, shouldn't setting the Color Property, if the color exists on the palette, show that color selected with a box around it? Am I doing something wrong?

Hi,

Can you please clarify your question?

Link to comment
Share on other sites

Suppose user has a component of color clRed. I want the ColorPalette to put the box around the color red on the palette, to indicate the current color red. Then

user can click another color, say clGreen, to change the color. Then I would read the color choice of green. 

Link to comment
Share on other sites

7 hours ago, dkeene said:

Suppose user has a component of color clRed. I want the ColorPalette to put the box around the color red on the palette, to indicate the current color red.

If I understand you correctly, you can simply use UniColorPalette.Color property.

Link to comment
Share on other sites

but if I set UniColorPalette.Color to clRed, the red square on the palate does not get a rectangle around it to 

show it is chosen. It works, seemingly, the other way, if i 'Pick" red from the color patches, uniColorPalette.Color is set to red.

I would hope that setting uniColorPalette.Color to clRed would "show" that red was chosen on the color patches...

am i doing something wrong?

Link to comment
Share on other sites

You can try to use this approach:

1.

Uses ..., UniGUIJSUtils, uniStrUtils;

2. 

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  with UniColorPalette1 do
  begin
    Color := clGreen;
    JSInterface.JSCall('select', [UniStringReplace(uniColor2Web(Color), '#', '')]);
  end;

end;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...