Jump to content

Frame Color Does Not Change


mos

Recommended Posts

I have a frame and a single image on the frame which has it's onClick event set.

 

The code in the onClick event toggles the color of the Frame:

procedure TUniFrame1.UniImage1Click(Sender: TObject);
begin
  if Self.Color = clRed then
    Self.Color := clBtnFace
  else
    Self.Color := clRed;
end;

What happens is that when you click the image the very first time the Frame color is red.

 

However when you click it again to reset the color back to clBtnFace it doesn't change.

Link to comment
Share on other sites

"Seems this happens with some colors including clBtnFace"

 

Can you try this approach for now ?!:

 

1.

UniFrame1.Color => $00F0F0F0

2.

procedure TUniFrame1.UniImage1Click(Sender: TObject);
begin
  if Self.Color = clRed then
    Self.Color := $00F0F0F0
  else
    Self.Color := clRed;
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...