dkeene Posted May 7, 2020 Posted May 7, 2020 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 Quote
Sherzod Posted May 7, 2020 Posted May 7, 2020 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? Quote
dkeene Posted May 7, 2020 Author Posted May 7, 2020 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. Quote
Sherzod Posted May 7, 2020 Posted May 7, 2020 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. Quote
dkeene Posted May 8, 2020 Author Posted May 8, 2020 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? Quote
Sherzod Posted May 8, 2020 Posted May 8, 2020 If you set the color in designtime, works? Problem in runtime? Quote
Sherzod Posted May 8, 2020 Posted May 8, 2020 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; Quote
dkeene Posted May 8, 2020 Author Posted May 8, 2020 Thanks I will try Perfect solution! Thank you. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.